Files
vms/nix/continue.nix
T

110 lines
2.4 KiB
Nix
Raw Normal View History

2024-11-18 22:26:17 -06:00
{
pkgs,
qemu_list,
vbox_list,
hyperv_list,
...
}:
let
general = {
stage = "build";
cache = [
{
key = {
files = [ "sources/build.pkr.hcl" ];
};
paths = [ "./packer_config/" ];
}
];
variables = {
PACKER_CONFIG_DIR = "./packer_config/";
PACKER_CACHE_DIR = "./cache/";
PACKER_LOG = "1";
};
2024-11-18 22:26:17 -06:00
rules = [
{
"if" = "$CI_COMMIT_TAG";
variables = {
EXCEPT = "";
JOB_PREFIX = "upload";
};
}
{
"if" = "$CI_COMMIT_TAG =~ \"/^$/\"";
variables = {
EXCEPT = "-except=upload";
2024-11-19 06:46:43 +00:00
JOB_PREFIX = "ci";
2024-11-18 22:26:17 -06:00
};
}
];
needs = [
{
pipeline = "$PARENT_PIPELINE_ID";
job = "generate";
artifacts = true;
}
];
script = [
2024-11-19 06:46:43 +00:00
"nix run \".#\\\"\${JOB_PREFIX}\${buildcmd}\\\"\" || exit 1"
2024-11-18 22:26:17 -06:00
];
};
continue = {
stages = [
"build"
"release"
];
"qemu.amd64" = general // {
2024-11-18 22:42:31 -06:00
tags = [ "qemu" ];
parallel.matrix = qemu_list;
2024-11-18 22:26:17 -06:00
};
"virtualbox-iso.amd64" = general // {
tags = [ "vbox" ];
parallel.matrix = vbox_list;
2024-11-18 22:26:17 -06:00
};
"hyperv-iso.amd64" = general // {
tags = [ "hyperv" ];
parallel.matrix = hyperv_list;
2024-11-18 22:26:17 -06:00
script = [
"packer init sources"
2024-11-19 07:28:18 +00:00
"echo 'packer build -only=\"hyperv-iso.amd64\" -var-file=\"\${distro}\" -var build=\${BUILD} -var cpus=2 -var memory=4096 \${EXCEPT} sources' > build.ps1"
"echo 'if (-not $?) { throw \"Error in build\" }' >> build.ps1"
2024-11-19 07:24:17 +00:00
"cat build.ps1"
"pwsh .\\build.ps1"
2024-11-18 22:26:17 -06:00
];
};
"Create release" = {
stage = "release";
image = "registry.gitlab.com/gitlab-org/release-cli:latest";
rules = [
{
2024-11-19 06:54:56 +00:00
"if" = "$CI_COMMIT_TAG";
}
2024-11-19 06:55:39 +00:00
];
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}
'';
};
};
2024-11-18 22:26:17 -06:00
};
in
pkgs.writeText "continue.yml" (builtins.toJSON continue)