{ pkgs, qemu_list, vbox_list, hyperv_list, ... }: let general = { stage = "build"; cache = [ { key = { files = [ "sources/build.pkr.hcl" ]; }; paths = [ "./packer_config/" ]; } ]; rules = [ { "if" = "$CI_COMMIT_TAG"; variables = { EXCEPT = ""; JOB_PREFIX = "upload"; }; } { "if" = "$CI_COMMIT_TAG =~ \"/^$/\""; variables = { EXCEPT = "-except=upload"; JOB_PREFIX = "ci"; }; } ]; needs = [ { pipeline = "$PARENT_PIPELINE_ID"; job = "generate"; artifacts = true; } ]; script = [ "nix run \".#\\\"\${JOB_PREFIX}\${buildcmd}\\\"\" || exit 1" ]; }; variables = { PACKER_CONFIG_DIR = "./packer_config/"; PACKER_CACHE_DIR = "./cache/"; PACKER_LOG = "1"; }; continue = { stages = [ "build" "release" ]; "qemu.amd64" = general // { variables = variables // { only = "-only=qemu.amd64"; }; tags = [ "qemu" ]; parallel = { matrix = qemu_list; }; before_script = [ "echo $BUILD" "env" ]; }; "virtualbox-iso.amd64" = general // { variables = variables // { only = "-only=\"virtualbox-iso.amd64\""; }; tags = [ "vbox" ]; parallel = { matrix = vbox_list; }; }; "hyperv-iso.amd64" = general // { variables = variables // { only = "-only=\"hyperv-iso.amd64\""; }; tags = [ "hyperv" ]; parallel = { matrix = hyperv_list; }; script = [ "packer init sources" "packer build -only=\"hyperv-iso.amd64\" -var-file=\"\${distro}\" -var build=\${BUILD} -var cpus=2 -var memory=4096 \${EXCEPT} sources" "if (-not $?) { throw \"Error in build\" }" ]; }; "Create release" = { stage = "release"; image = "registry.gitlab.com/gitlab-org/release-cli:latest"; rules = [ { if = "$CI_COMMIT_TAG"; } ]; script = "echo \"Tagging as released\""; needs = [ { pipeline = "$PARENT_PIPELINE_ID"; job = "continue"; artifacts = true; } { pipeline = "$PARENT_PIPELINE_ID"; job = "generate"; artifacts = true; } ]; release = { tag_name = "$CI_COMMIT_TAG"; description = '' Release $CI_COMMIT_TAG, found on [Vagrant Cloud](https://app.vagrantup.com/boxen/) as version v''${BUILD} ''; }; }; }; in pkgs.writeText "continue.yml" (builtins.toJSON continue)