There is no need to wait until after validation and linting is done before beginning the download caching, and it definitely does not need its own portion of the cycle. Move it to the beginning of the generate phase, so it gets started up right away.
85 lines
1.6 KiB
YAML
85 lines
1.6 KiB
YAML
stages:
|
|
- generate
|
|
- lint
|
|
- 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
|
|
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
|
|
tags:
|
|
- nix
|
|
script:
|
|
- nix build ".#continue"
|
|
- cp result .gitlab-ci-build.yml
|
|
- cat result
|
|
|
|
validate:
|
|
stage: lint
|
|
tags:
|
|
- nix
|
|
needs:
|
|
- generate
|
|
cache:
|
|
- key:
|
|
files:
|
|
- sources/build.pkr.hcl
|
|
paths:
|
|
- ./packer_config/
|
|
script: nix run ".#validate"
|
|
|
|
shellcheck:
|
|
stage: lint
|
|
tags:
|
|
- nix
|
|
script: nix run ".#shellcheck"
|
|
|
|
# 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: generate
|
|
retry: 2
|
|
tags:
|
|
- nix
|
|
cache:
|
|
- key:
|
|
files:
|
|
- sources/build.pkr.hcl
|
|
paths:
|
|
- ./packer_config/
|
|
script:
|
|
- nix run ".#cache-restore"
|
|
- nix run ".#cache"
|
|
|
|
trigger:
|
|
stage: trigger
|
|
trigger:
|
|
include:
|
|
- artifact: .gitlab-ci-build.yml
|
|
job: distros
|
|
variables:
|
|
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
|