89 lines
1.8 KiB
YAML
89 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
|
|
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 -e SC2239 $(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
|
|
retry: 2
|
|
cache:
|
|
- key:
|
|
files:
|
|
- sources/build.pkr.hcl
|
|
paths:
|
|
- ./packer_config/
|
|
script:
|
|
- packer init sources
|
|
- bash cache.sh
|
|
- mc alias add storage "localhost:9000" root "$MINIO_SECRET"
|
|
- |
|
|
for f in cache/*; do
|
|
mc put "$f" "storage/isos/$f"
|
|
end
|
|
|
|
trigger:
|
|
stage: trigger
|
|
trigger:
|
|
include:
|
|
- artifact: .gitlab-ci-build.yml
|
|
job: distros
|
|
variables:
|
|
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
|