2021-05-27 23:03:20 +02:00
|
|
|
{ nixpkgs, pulls, ... }:
|
2020-04-18 01:03:15 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
pkgs = import nixpkgs {};
|
|
|
|
|
|
|
|
prs = builtins.fromJSON (builtins.readFile pulls);
|
|
|
|
prJobsets = pkgs.lib.mapAttrs (num: info:
|
|
|
|
{ enabled = 1;
|
|
|
|
hidden = false;
|
|
|
|
description = "PR ${num}: ${info.title}";
|
|
|
|
checkinterval = 30;
|
|
|
|
schedulingshares = 20;
|
|
|
|
enableemail = false;
|
|
|
|
emailoverride = "";
|
|
|
|
keepnr = 1;
|
2021-07-10 16:05:25 +02:00
|
|
|
type = 1;
|
|
|
|
flake = "gitlab:simple-nixos-mailserver/nixos-mailserver/merge-requests/${info.iid}/head";
|
2020-04-18 01:03:15 +02:00
|
|
|
}
|
|
|
|
) prs;
|
2021-07-12 23:28:02 +02:00
|
|
|
mkFlakeJobset = branch: {
|
2021-06-06 09:52:00 +02:00
|
|
|
description = "Build ${branch} branch of Simple NixOS MailServer";
|
|
|
|
checkinterval = "60";
|
|
|
|
enabled = "1";
|
|
|
|
schedulingshares = 100;
|
|
|
|
enableemail = false;
|
|
|
|
emailoverride = "";
|
|
|
|
keepnr = 3;
|
|
|
|
hidden = false;
|
2021-07-10 16:05:25 +02:00
|
|
|
type = 1;
|
|
|
|
flake = "gitlab:simple-nixos-mailserver/nixos-mailserver/${branch}";
|
2022-02-20 11:29:33 +01:00
|
|
|
};
|
2021-06-06 09:52:00 +02:00
|
|
|
|
|
|
|
desc = prJobsets // {
|
2021-07-12 23:28:02 +02:00
|
|
|
"master" = mkFlakeJobset "master";
|
2020-04-18 01:03:15 +02:00
|
|
|
};
|
|
|
|
|
2021-07-10 16:05:25 +02:00
|
|
|
log = {
|
|
|
|
pulls = prs;
|
|
|
|
jobsets = desc;
|
|
|
|
};
|
|
|
|
|
2020-04-18 01:03:15 +02:00
|
|
|
in {
|
|
|
|
jobsets = pkgs.runCommand "spec-jobsets.json" {} ''
|
|
|
|
cat >$out <<EOF
|
|
|
|
${builtins.toJSON desc}
|
|
|
|
EOF
|
2021-07-10 16:05:25 +02:00
|
|
|
# This is to get nice .jobsets build logs on Hydra
|
|
|
|
cat >tmp <<EOF
|
|
|
|
${builtins.toJSON log}
|
|
|
|
EOF
|
|
|
|
${pkgs.jq}/bin/jq . tmp
|
2020-04-18 01:03:15 +02:00
|
|
|
'';
|
|
|
|
}
|