Skip to content

Commit ed40f1f

Browse files
committed
[DDW-1083] Build for all clusters in Cicero
1 parent b04c455 commit ed40f1f

File tree

1 file changed

+32
-28
lines changed

1 file changed

+32
-28
lines changed

nix/tullia.nix

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -112,36 +112,40 @@ let
112112
done
113113
}
114114
115-
installable=${pkgs.lib.escapeShellArg "packages.${targetSystem}.installer"}
115+
for cluster in $(cat ./installer-clusters.cfg) ; do
116116
117-
${
118-
# XXX: this is nasty, but on Darwin, we often trigger auto-gc, which has races
119-
# (<https://github.com/NixOS/nix/issues/6757>, <https://github.com/NixOS/nix/issues/1970>,
120-
# <https://input-output-rnd.slack.com/archives/C02H2Q4L54Y/p1677172044575869>),
121-
# and builds fail. Furthermore, you can’t trigger a GC remotely. We also can’t control
122-
# `--builders` with `driver=exec`, and `driver=podman` fails randomly and often with
123-
# “image not found”. Let’s then trigger auto-gc in first try/tries, and then retry the build.
124-
# That usually works.
125-
if pkgs.lib.hasInfix "darwin" targetSystem
126-
then "retry 4"
127-
else ""
128-
} nix build --out-link ${pkgs.lib.escapeShellArg outLink} --cores 1 --max-jobs 1 -L ".#$installable"
117+
installable=${pkgs.lib.escapeShellArg "packages.${targetSystem}.installer"}."$cluster"
129118
130-
# XXX: create a link to the artifact:
131-
export PATH="${pkgs.lib.makeBinPath (with pkgs; [curl jq gnused])}:$PATH"
132-
jq --null-input \
133-
--arg system ${pkgs.lib.escapeShellArg targetSystem} \
134-
--arg url "$(realpath ${pkgs.lib.escapeShellArg outLink}/*${pkgs.lib.escapeShellArg targetSystem}* | sed -r 's,^/nix/store/,https://nar-proxy.ci.iog.io/dl/,')" \
135-
'.[$system] = $url' \
136-
| curl "$CICERO_WEB_URL"/api/run/"$NOMAD_JOB_ID"/fact \
137-
--header @<(
138-
# cannot use --oauth2-bearer as that leaks the token in the CLI args
139-
echo -n 'Authorization: Bearer '
140-
cat /secrets/cicero-token
141-
) \
142-
--output /dev/null --fail \
143-
--no-progress-meter \
144-
--data-binary @-
119+
${
120+
# XXX: this is nasty, but on Darwin, we often trigger auto-gc, which has races
121+
# (<https://github.com/NixOS/nix/issues/6757>, <https://github.com/NixOS/nix/issues/1970>,
122+
# <https://input-output-rnd.slack.com/archives/C02H2Q4L54Y/p1677172044575869>),
123+
# and builds fail. Furthermore, you can’t trigger a GC remotely. We also can’t control
124+
# `--builders` with `driver=exec`, and `driver=podman` fails randomly and often with
125+
# “image not found”. Let’s then trigger auto-gc in first try/tries, and then retry the build.
126+
# That usually works.
127+
if pkgs.lib.hasInfix "darwin" targetSystem
128+
then "retry 4"
129+
else ""
130+
} nix build --out-link ${pkgs.lib.escapeShellArg outLink} --cores 1 --max-jobs 1 -L ".#$installable"
131+
132+
# XXX: create a link to the artifact:
133+
export PATH="${pkgs.lib.makeBinPath (with pkgs; [curl jq gnused])}:$PATH"
134+
jq --null-input \
135+
--arg system ${pkgs.lib.escapeShellArg targetSystem} \
136+
--arg url "$(realpath ${pkgs.lib.escapeShellArg outLink}/*${pkgs.lib.escapeShellArg targetSystem}* | sed -r 's,^/nix/store/,https://nar-proxy.ci.iog.io/dl/,')" \
137+
'.[$system] = $url' \
138+
| curl "$CICERO_WEB_URL"/api/run/"$NOMAD_JOB_ID"/fact \
139+
--header @<(
140+
# cannot use --oauth2-bearer as that leaks the token in the CLI args
141+
echo -n 'Authorization: Bearer '
142+
cat /secrets/cicero-token
143+
) \
144+
--output /dev/null --fail \
145+
--no-progress-meter \
146+
--data-binary @-
147+
148+
done
145149
'';
146150
};
147151

0 commit comments

Comments
 (0)