Files
vms/nix/continue.nix
T

99 lines
2.0 KiB
Nix

{
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_PREIX = "ci";
};
}
];
needs = [
{
pipeline = "$PARENT_PIPELINE_ID";
job = "generate";
artifacts = true;
}
];
script = [
"nix run \".#\\\"\${JOB_PREIX}\${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\")"
];
};
};
in
pkgs.writeText "continue.yml" (builtins.toJSON continue)