Since the builds themselves get run in a big parallel morass of nonsense, this causes cache clobbering all over. So now I move the downloading to the pre-trigger stage and hopefully we can use the pre-download step to cache things properly. Hopefully this will also prevent issues where dynamically generated download files are missing for later runs.
92 lines
2.0 KiB
YAML
92 lines
2.0 KiB
YAML
stages:
|
|
- generate
|
|
- lint
|
|
- cache
|
|
- trigger
|
|
|
|
variables:
|
|
PACKER_CONFIG_DIR: ./packer_config/
|
|
PACKER_CACHE_DIR: ./cache/
|
|
|
|
generate:
|
|
stage: generate
|
|
artifacts:
|
|
paths:
|
|
- distros/**/*.pkrvars.hcl
|
|
script: |-
|
|
for vars in $(find distros/ -name '*.pkrvars.hcl.sh'); do
|
|
"./${vars}"
|
|
done
|
|
|
|
distros:
|
|
stage: generate
|
|
image: $CI_REGISTRY_DIRECT/greg/ci-images/fedora:latest
|
|
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
|
|
image: $CI_REGISTRY_DIRECT/greg/ci-images/fedora:latest
|
|
cache:
|
|
- key: isofiles
|
|
paths:
|
|
- cache/*.iso
|
|
- 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
|
|
file=$(echo var.iso.url | packer console -var-file=${vars} -config-type=hcl2 sources/)
|
|
pushd cache
|
|
curl -O "${file}"
|
|
popd
|
|
done
|
|
|
|
trigger:
|
|
stage: trigger
|
|
trigger:
|
|
include:
|
|
- artifact: .gitlab-ci-build.yml
|
|
job: distros
|
|
variables:
|
|
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
|