Streamline the push and build process
This commit is contained in:
+11
-63
@@ -3,6 +3,17 @@ stages:
|
|||||||
- check
|
- check
|
||||||
- trigger
|
- trigger
|
||||||
|
|
||||||
|
include:
|
||||||
|
# Low-effort, we can always do lint checks, validations, and so forth
|
||||||
|
- local: .gitlab/always.yml
|
||||||
|
# Actual download of ISOs and building of images. This should only be
|
||||||
|
# done some of the time
|
||||||
|
- local: .gitlab/build.yml
|
||||||
|
rules:
|
||||||
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||||
|
- if: $CI_PIPELINE_SOURCE == "tag"
|
||||||
|
- if: $CI_COMMIT_BRANCH == "main"
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
PACKER_CONFIG_DIR: ./packer_config/
|
PACKER_CONFIG_DIR: ./packer_config/
|
||||||
PACKER_CACHE_DIR: ./cache/
|
PACKER_CACHE_DIR: ./cache/
|
||||||
@@ -11,66 +22,3 @@ default:
|
|||||||
image: registry.thehellings.com/greg/ci-images/vm-test:latest
|
image: registry.thehellings.com/greg/ci-images/vm-test:latest
|
||||||
tags:
|
tags:
|
||||||
- nix
|
- nix
|
||||||
|
|
||||||
generate:
|
|
||||||
stage: generate
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- distros/**/*.pkrvars.hcl
|
|
||||||
reports:
|
|
||||||
dotenv: build.env
|
|
||||||
script: nix run ".#generate"
|
|
||||||
|
|
||||||
continue:
|
|
||||||
stage: generate
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- .gitlab-ci-build.yml
|
|
||||||
script:
|
|
||||||
- nix build ".#continue"
|
|
||||||
- cp result .gitlab-ci-build.yml
|
|
||||||
- cat result
|
|
||||||
|
|
||||||
shellcheck:
|
|
||||||
stage: generate
|
|
||||||
script: nix run ".#shellcheck"
|
|
||||||
|
|
||||||
flake-check:
|
|
||||||
stage: generate
|
|
||||||
script: nix flake check
|
|
||||||
|
|
||||||
validate:
|
|
||||||
stage: check
|
|
||||||
needs:
|
|
||||||
- generate
|
|
||||||
cache:
|
|
||||||
- key:
|
|
||||||
files:
|
|
||||||
- sources/build.pkr.hcl
|
|
||||||
paths:
|
|
||||||
- ./packer_config/
|
|
||||||
script: nix run ".#validate"
|
|
||||||
|
|
||||||
# Makes sure that all of the ISO files we are looking for are
|
|
||||||
# present on the S3 buckets that we use
|
|
||||||
downloads:
|
|
||||||
stage: check
|
|
||||||
retry: 2
|
|
||||||
needs:
|
|
||||||
- generate
|
|
||||||
cache:
|
|
||||||
- key:
|
|
||||||
files:
|
|
||||||
- sources/build.pkr.hcl
|
|
||||||
paths:
|
|
||||||
- ./packer_config/
|
|
||||||
script: nix run ".#cache"
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
stage: trigger
|
|
||||||
trigger:
|
|
||||||
include:
|
|
||||||
- artifact: .gitlab-ci-build.yml
|
|
||||||
job: continue
|
|
||||||
variables:
|
|
||||||
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
|
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
generate:
|
||||||
|
stage: generate
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- distros/**/*.pkrvars.hcl
|
||||||
|
reports:
|
||||||
|
dotenv: build.env
|
||||||
|
script: nix run ".#generate"
|
||||||
|
|
||||||
|
continue:
|
||||||
|
stage: generate
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- .gitlab-ci-build.yml
|
||||||
|
script:
|
||||||
|
- nix build ".#continue"
|
||||||
|
- cp result .gitlab-ci-build.yml
|
||||||
|
- cat result
|
||||||
|
|
||||||
|
shellcheck:
|
||||||
|
stage: generate
|
||||||
|
script: nix run ".#shellcheck"
|
||||||
|
|
||||||
|
flake-check:
|
||||||
|
stage: generate
|
||||||
|
script: nix flake check
|
||||||
|
|
||||||
|
validate:
|
||||||
|
stage: check
|
||||||
|
needs:
|
||||||
|
- generate
|
||||||
|
cache:
|
||||||
|
- key:
|
||||||
|
files:
|
||||||
|
- sources/build.pkr.hcl
|
||||||
|
paths:
|
||||||
|
- ./packer_config/
|
||||||
|
script: nix run ".#validate"
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# These jobs actually fetch the downloads and trigger the
|
||||||
|
# target builds. I don't want to do that on every single push,
|
||||||
|
# but only when I'm part of a merge request or release event
|
||||||
|
|
||||||
|
# Makes sure that all of the ISO files we are looking for are
|
||||||
|
# present on the S3 buckets that we use
|
||||||
|
downloads:
|
||||||
|
stage: check
|
||||||
|
retry: 2
|
||||||
|
needs:
|
||||||
|
- generate
|
||||||
|
cache:
|
||||||
|
- key:
|
||||||
|
files:
|
||||||
|
- sources/build.pkr.hcl
|
||||||
|
paths:
|
||||||
|
- ./packer_config/
|
||||||
|
script: nix run ".#cache"
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
stage: trigger
|
||||||
|
trigger:
|
||||||
|
include:
|
||||||
|
- artifact: .gitlab-ci-build.yml
|
||||||
|
job: continue
|
||||||
|
variables:
|
||||||
|
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
|
||||||
Reference in New Issue
Block a user