Files
vms/.gitlab-ci.yml
T
2024-04-16 14:49:39 -05:00

90 lines
1.8 KiB
YAML

stages:
- generate
- lint
- cache
- trigger
variables:
PACKER_CONFIG_DIR: ./packer_config/
PACKER_CACHE_DIR: ./cache/
default:
image: registry.thehellings.com/greg/ci-images/vm-test:latest
generate:
stage: generate
cache:
- key: isofiles
paths:
- cache/*.iso
artifacts:
paths:
- distros/**/*.pkrvars.hcl
script: |-
for vars in $(find distros/ -name '*.pkrvars.hcl.sh'); do
bash "./${vars}"
done
distros:
stage: generate
artifacts:
reports:
dotenv: build.env
paths:
- .gitlab-ci-build.yml
script: |-
xonsh ./build.xsh -a --list
echo "BUILD=$(date +'%Y.%m.%d.%H')" >> build.env
validate:
stage: lint
needs:
- generate
cache:
- key:
files:
- sources/build.pkr.hcl
paths:
- ./packer_config/
script: |-
set -exo pipefail
packer init sources
for vars in $(find distros/ -name '*.pkrvars.hcl'); do
packer validate -except=upload -var-file=${vars} sources/
done
shellcheck:
stage: lint
script: |-
shellcheck --version
shellcheck $(find . -name '*.sh')
# Downloads all the ISO files so that we have a single cache with all
# of them present. This prevents a race condition where some of the
# files were being downloaded multiple times due to parallel jobs, and
# others were disappearing (e.g. daily builds for Rawhide) before we
# could get to them
downloads:
stage: cache
cache:
- key: isofiles
paths:
- cache/*.iso
- key:
files:
- sources/build.pkr.hcl
paths:
- ./packer_config/
script:
- packer init sources
- bash cache.sh
trigger:
stage: trigger
trigger:
include:
- artifact: .gitlab-ci-build.yml
job: distros
variables:
PARENT_PIPELINE_ID: $CI_PIPELINE_ID