@norskvideo/ctl-dev-kit 0.2.122 → 0.2.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -205,8 +205,39 @@ jobs:
|
|
|
205
205
|
ver="$( { sed -nE 's/^[[:space:]]*ctlVersion = "([^"]+)";.*/\1/p' flake.nix 2>/dev/null || true; } | head -1)"
|
|
206
206
|
[ -n "$ver" ] || { echo "::error::flake.nix pins no ctlVersion. CI runs the norsk-ctl this commit pins (the nightly bump.yml moves it); add ctlVersion = \"<version>\"; to flake.nix."; exit 1; }
|
|
207
207
|
echo "norsk-ctl pinned by flake.nix ctlVersion -> $ver"
|
|
208
|
-
|
|
209
|
-
|
|
208
|
+
fetched=s3
|
|
209
|
+
# The flake's norsk-ctl package is this same pin (ctlVersion + hash): the
|
|
210
|
+
# runner's nix store fetches a version once, rooted per repo under _work
|
|
211
|
+
# (RUNNER_TEMP is wiped every job). Copied out, not linked: ctl keys its
|
|
212
|
+
# asset extraction on its own mtime, and every store path's is 1. A flake
|
|
213
|
+
# with no such package (an sdk-app's) takes the pin from S3.
|
|
214
|
+
# The host GCs its /nix (the runner containers share it): the root guards
|
|
215
|
+
# the path only because every runner taking these jobs has its work dir at
|
|
216
|
+
# the same path on the host as in the container (id3as/jankings).
|
|
217
|
+
# A renamed or deleted repo's root stays behind: bounded, one version each.
|
|
218
|
+
if pkg="$(nix eval --raw .#norsk-ctl.version 2>"$RUNNER_TEMP/ctl-eval.err")"; then
|
|
219
|
+
[ "$pkg" = "$ver" ] || { echo "::error::flake.nix's norsk-ctl package is $pkg, not its ctlVersion $ver"; exit 1; }
|
|
220
|
+
root="${RUNNER_TEMP%/*}/_norsk-ctl-gcroot/${GITHUB_REPOSITORY//\//_}"
|
|
221
|
+
if [ -L "$root" ] && [ ! -e "$root" ]; then
|
|
222
|
+
echo "::warning::norsk-ctl's GC root $root dangled since the last job here: the host's nix GC did not see it, so this runner's work dir is probably not at the same path on the host as in the container (id3as/jankings)"
|
|
223
|
+
fi
|
|
224
|
+
nix build .#norsk-ctl --out-link "$root" || {
|
|
225
|
+
echo "::error::.#norsk-ctl failed to build; if ctlVersion was edited by hand, refresh the hashes (bump.yml does it nightly; id3as/norsk-ctl packages/dev-kit/build/refresh-ctl-pin.sh by hand)"
|
|
226
|
+
exit 1
|
|
227
|
+
}
|
|
228
|
+
install -m 755 "$root/bin/norsk-ctl" "$RUNNER_TEMP/norsk-ctl"
|
|
229
|
+
echo "norsk-ctl from flake package $(readlink "$root")"
|
|
230
|
+
fetched=nix
|
|
231
|
+
elif grep -q "does not provide attribute" "$RUNNER_TEMP/ctl-eval.err"; then
|
|
232
|
+
echo "flake has no norsk-ctl package ($(grep -m1 "does not provide attribute" "$RUNNER_TEMP/ctl-eval.err")); fetching $ver from S3"
|
|
233
|
+
else
|
|
234
|
+
cat "$RUNNER_TEMP/ctl-eval.err" >&2
|
|
235
|
+
exit 1
|
|
236
|
+
fi
|
|
237
|
+
if [ "$fetched" = s3 ]; then
|
|
238
|
+
curl -fsSL --retry 3 --retry-all-errors --retry-delay 2 "$S3/$ver/norsk-ctl-$ver-linux-x64" -o "$RUNNER_TEMP/norsk-ctl"
|
|
239
|
+
chmod +x "$RUNNER_TEMP/norsk-ctl"
|
|
240
|
+
fi
|
|
210
241
|
"$RUNNER_TEMP/norsk-ctl" --version || true
|
|
211
242
|
|
|
212
243
|
# Cold-runner first pulls overrun the harness's per-test launch timeouts;
|
|
@@ -456,8 +456,39 @@ jobs:
|
|
|
456
456
|
ver="$( { sed -nE 's/^[[:space:]]*ctlVersion = "([^"]+)";.*/\1/p' flake.nix 2>/dev/null || true; } | head -1)"
|
|
457
457
|
[ -n "$ver" ] || { echo "::error::flake.nix pins no ctlVersion. CI runs the norsk-ctl this commit pins (the nightly bump.yml moves it); add ctlVersion = \"<version>\"; to flake.nix."; exit 1; }
|
|
458
458
|
echo "norsk-ctl pinned by flake.nix ctlVersion -> $ver"
|
|
459
|
-
|
|
460
|
-
|
|
459
|
+
fetched=s3
|
|
460
|
+
# The flake's norsk-ctl package is this same pin (ctlVersion + hash): the
|
|
461
|
+
# runner's nix store fetches a version once, rooted per repo under _work
|
|
462
|
+
# (RUNNER_TEMP is wiped every job). Copied out, not linked: ctl keys its
|
|
463
|
+
# asset extraction on its own mtime, and every store path's is 1. A flake
|
|
464
|
+
# with no such package (an sdk-app's) takes the pin from S3.
|
|
465
|
+
# The host GCs its /nix (the runner containers share it): the root guards
|
|
466
|
+
# the path only because every runner taking these jobs has its work dir at
|
|
467
|
+
# the same path on the host as in the container (id3as/jankings).
|
|
468
|
+
# A renamed or deleted repo's root stays behind: bounded, one version each.
|
|
469
|
+
if pkg="$(nix eval --raw .#norsk-ctl.version 2>"$RUNNER_TEMP/ctl-eval.err")"; then
|
|
470
|
+
[ "$pkg" = "$ver" ] || { echo "::error::flake.nix's norsk-ctl package is $pkg, not its ctlVersion $ver"; exit 1; }
|
|
471
|
+
root="${RUNNER_TEMP%/*}/_norsk-ctl-gcroot/${GITHUB_REPOSITORY//\//_}"
|
|
472
|
+
if [ -L "$root" ] && [ ! -e "$root" ]; then
|
|
473
|
+
echo "::warning::norsk-ctl's GC root $root dangled since the last job here: the host's nix GC did not see it, so this runner's work dir is probably not at the same path on the host as in the container (id3as/jankings)"
|
|
474
|
+
fi
|
|
475
|
+
nix build .#norsk-ctl --out-link "$root" || {
|
|
476
|
+
echo "::error::.#norsk-ctl failed to build; if ctlVersion was edited by hand, refresh the hashes (bump.yml does it nightly; id3as/norsk-ctl packages/dev-kit/build/refresh-ctl-pin.sh by hand)"
|
|
477
|
+
exit 1
|
|
478
|
+
}
|
|
479
|
+
install -m 755 "$root/bin/norsk-ctl" "$RUNNER_TEMP/norsk-ctl"
|
|
480
|
+
echo "norsk-ctl from flake package $(readlink "$root")"
|
|
481
|
+
fetched=nix
|
|
482
|
+
elif grep -q "does not provide attribute" "$RUNNER_TEMP/ctl-eval.err"; then
|
|
483
|
+
echo "flake has no norsk-ctl package ($(grep -m1 "does not provide attribute" "$RUNNER_TEMP/ctl-eval.err")); fetching $ver from S3"
|
|
484
|
+
else
|
|
485
|
+
cat "$RUNNER_TEMP/ctl-eval.err" >&2
|
|
486
|
+
exit 1
|
|
487
|
+
fi
|
|
488
|
+
if [ "$fetched" = s3 ]; then
|
|
489
|
+
curl -fsSL --retry 3 --retry-all-errors --retry-delay 2 "$S3/$ver/norsk-ctl-$ver-linux-x64" -o "$RUNNER_TEMP/norsk-ctl"
|
|
490
|
+
chmod +x "$RUNNER_TEMP/norsk-ctl"
|
|
491
|
+
fi
|
|
461
492
|
"$RUNNER_TEMP/norsk-ctl" --version || true
|
|
462
493
|
|
|
463
494
|
# Cold-runner first pulls overrun the harness's per-test launch timeouts;
|
|
@@ -661,8 +692,39 @@ jobs:
|
|
|
661
692
|
ver="$( { sed -nE 's/^[[:space:]]*ctlVersion = "([^"]+)";.*/\1/p' flake.nix 2>/dev/null || true; } | head -1)"
|
|
662
693
|
[ -n "$ver" ] || { echo "::error::flake.nix pins no ctlVersion. CI runs the norsk-ctl this commit pins (the nightly bump.yml moves it); add ctlVersion = \"<version>\"; to flake.nix."; exit 1; }
|
|
663
694
|
echo "norsk-ctl pinned by flake.nix ctlVersion -> $ver"
|
|
664
|
-
|
|
665
|
-
|
|
695
|
+
fetched=s3
|
|
696
|
+
# The flake's norsk-ctl package is this same pin (ctlVersion + hash): the
|
|
697
|
+
# runner's nix store fetches a version once, rooted per repo under _work
|
|
698
|
+
# (RUNNER_TEMP is wiped every job). Copied out, not linked: ctl keys its
|
|
699
|
+
# asset extraction on its own mtime, and every store path's is 1. A flake
|
|
700
|
+
# with no such package (an sdk-app's) takes the pin from S3.
|
|
701
|
+
# The host GCs its /nix (the runner containers share it): the root guards
|
|
702
|
+
# the path only because every runner taking these jobs has its work dir at
|
|
703
|
+
# the same path on the host as in the container (id3as/jankings).
|
|
704
|
+
# A renamed or deleted repo's root stays behind: bounded, one version each.
|
|
705
|
+
if pkg="$(nix eval --raw .#norsk-ctl.version 2>"$RUNNER_TEMP/ctl-eval.err")"; then
|
|
706
|
+
[ "$pkg" = "$ver" ] || { echo "::error::flake.nix's norsk-ctl package is $pkg, not its ctlVersion $ver"; exit 1; }
|
|
707
|
+
root="${RUNNER_TEMP%/*}/_norsk-ctl-gcroot/${GITHUB_REPOSITORY//\//_}"
|
|
708
|
+
if [ -L "$root" ] && [ ! -e "$root" ]; then
|
|
709
|
+
echo "::warning::norsk-ctl's GC root $root dangled since the last job here: the host's nix GC did not see it, so this runner's work dir is probably not at the same path on the host as in the container (id3as/jankings)"
|
|
710
|
+
fi
|
|
711
|
+
nix build .#norsk-ctl --out-link "$root" || {
|
|
712
|
+
echo "::error::.#norsk-ctl failed to build; if ctlVersion was edited by hand, refresh the hashes (bump.yml does it nightly; id3as/norsk-ctl packages/dev-kit/build/refresh-ctl-pin.sh by hand)"
|
|
713
|
+
exit 1
|
|
714
|
+
}
|
|
715
|
+
install -m 755 "$root/bin/norsk-ctl" "$RUNNER_TEMP/norsk-ctl"
|
|
716
|
+
echo "norsk-ctl from flake package $(readlink "$root")"
|
|
717
|
+
fetched=nix
|
|
718
|
+
elif grep -q "does not provide attribute" "$RUNNER_TEMP/ctl-eval.err"; then
|
|
719
|
+
echo "flake has no norsk-ctl package ($(grep -m1 "does not provide attribute" "$RUNNER_TEMP/ctl-eval.err")); fetching $ver from S3"
|
|
720
|
+
else
|
|
721
|
+
cat "$RUNNER_TEMP/ctl-eval.err" >&2
|
|
722
|
+
exit 1
|
|
723
|
+
fi
|
|
724
|
+
if [ "$fetched" = s3 ]; then
|
|
725
|
+
curl -fsSL --retry 3 --retry-all-errors --retry-delay 2 "$S3/$ver/norsk-ctl-$ver-linux-x64" -o "$RUNNER_TEMP/norsk-ctl"
|
|
726
|
+
chmod +x "$RUNNER_TEMP/norsk-ctl"
|
|
727
|
+
fi
|
|
666
728
|
"$RUNNER_TEMP/norsk-ctl" --version || true
|
|
667
729
|
# Cold-runner first pulls overrun the harness's per-test launch timeouts;
|
|
668
730
|
# pre-pull the universal media + studio images (every product pins them in
|
|
@@ -128,6 +128,26 @@ export function importsCtlShell(flake: string): boolean {
|
|
|
128
128
|
return flake.includes(CTL_SHELL_IMPORT);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
// A Studio product's flake exposes its ctl pin as packages.<system>.norsk-ctl
|
|
132
|
+
// for every system the fleet runs on: CI builds it so the runner's nix store
|
|
133
|
+
// fetches each version once, and falls back to S3 (per job) on a runner whose
|
|
134
|
+
// system the flake leaves out. Checked as text, against the starter's shape.
|
|
135
|
+
export const CTL_PACKAGE_SYSTEMS = ["x86_64-linux", "aarch64-linux", "x86_64-darwin", "aarch64-darwin"] as const;
|
|
136
|
+
|
|
137
|
+
export function ctlPackageProblem(flake: string): string | undefined {
|
|
138
|
+
const systemsList = flake.match(/systems = \[([^\]]*)\]/)?.[1] ?? "";
|
|
139
|
+
const missing = CTL_PACKAGE_SYSTEMS.filter(
|
|
140
|
+
(sys) =>
|
|
141
|
+
!systemsList.includes(`"${sys}"`) ||
|
|
142
|
+
!new RegExp(`"${sys}"\\s*=\\s*\\{\\s*plat = "[^"]+";\\s*hash = "sha256-[^"]+";`).test(flake),
|
|
143
|
+
);
|
|
144
|
+
const exposed =
|
|
145
|
+
/\bpackages = forAllSystems\b/.test(flake) && /\bnorsk-ctl = \(ctlShell system\)\.mkCtl\b/.test(flake);
|
|
146
|
+
if (exposed && missing.length === 0) return undefined;
|
|
147
|
+
const what = exposed ? `for ${missing.join(", ")} (each needs a systems entry and a ctlAsset plat + hash)` : "at all";
|
|
148
|
+
return `flake.nix does not expose packages.<system>.norsk-ctl ${what}. CI builds the pinned ctl from that package and otherwise downloads it from S3 on every job; keep the build/flake.nix starter's packages + ctlAsset shape.`;
|
|
149
|
+
}
|
|
150
|
+
|
|
131
151
|
// dprint.json is canonical-plus-extension: the shared config is verbatim, but a
|
|
132
152
|
// repo may exclude paths only it has (e.g. probe's generated components/lib/)
|
|
133
153
|
// inside a sanctioned marker block at the head of `excludes`. Everything outside
|
|
@@ -766,6 +786,8 @@ export function checkDrift(repoRoot: string, canonical: CanonicalBytes, opts: Ch
|
|
|
766
786
|
problems.push(
|
|
767
787
|
`flake.nix does not build its shells from ${CTL_SHELL_PATH} (no \`${CTL_SHELL_IMPORT}\`). The shared shell pieces are single-sourced there; sync-drift migrates a legacy verbatim flake.`,
|
|
768
788
|
);
|
|
789
|
+
} else if (shape === "studio") {
|
|
790
|
+
push(ctlPackageProblem(readFileSync(flakePath, "utf8")));
|
|
769
791
|
}
|
|
770
792
|
push(verbatimProblem(repoRoot, "biome.json", "conventions/biome.base.json", canonical.biome));
|
|
771
793
|
push(verbatimProblem(repoRoot, "tsconfig.base.json", "conventions/tsconfig.base.json", canonical.tsconfigBase));
|
|
@@ -381,6 +381,7 @@ jobs:
|
|
|
381
381
|
*) echo "unsupported runner arch: $(uname -m)" >&2; exit 1 ;;
|
|
382
382
|
esac
|
|
383
383
|
S3="https://s3.eu-west-1.amazonaws.com/norsk.video/norsk-ctl"
|
|
384
|
+
fetched=s3
|
|
384
385
|
if [ -n "${CTL_CHANNEL:-}" ]; then
|
|
385
386
|
ver="$(curl -fsSL --retry 3 --retry-all-errors --retry-delay 2 "$S3/$CTL_CHANNEL")"
|
|
386
387
|
echo "norsk-ctl $CTL_CHANNEL channel -> $ver ($arch), in place of the repo pin"
|
|
@@ -388,9 +389,39 @@ jobs:
|
|
|
388
389
|
ver="$( { sed -nE 's/^[[:space:]]*ctlVersion = "([^"]+)";.*/\1/p' flake.nix 2>/dev/null || true; } | head -1)"
|
|
389
390
|
[ -n "$ver" ] || { echo "::error::flake.nix pins no ctlVersion. CI runs the norsk-ctl this commit pins (the nightly bump.yml moves it); add ctlVersion = \"<version>\"; to flake.nix."; exit 1; }
|
|
390
391
|
echo "norsk-ctl pinned by flake.nix ctlVersion -> $ver ($arch)"
|
|
392
|
+
# The flake's norsk-ctl package is this same pin (ctlVersion + hash): the
|
|
393
|
+
# runner's nix store fetches a version once, rooted per repo under _work
|
|
394
|
+
# (RUNNER_TEMP is wiped every job). Copied out, not linked: ctl keys its
|
|
395
|
+
# asset extraction on its own mtime, and every store path's is 1. A flake
|
|
396
|
+
# with no such package (an sdk-app's) takes the pin from S3.
|
|
397
|
+
# The host GCs its /nix (the runner containers share it): the root guards
|
|
398
|
+
# the path only because every runner taking these jobs has its work dir at
|
|
399
|
+
# the same path on the host as in the container (id3as/jankings).
|
|
400
|
+
# A renamed or deleted repo's root stays behind: bounded, one version each.
|
|
401
|
+
if pkg="$(nix eval --raw .#norsk-ctl.version 2>"$RUNNER_TEMP/ctl-eval.err")"; then
|
|
402
|
+
[ "$pkg" = "$ver" ] || { echo "::error::flake.nix's norsk-ctl package is $pkg, not its ctlVersion $ver"; exit 1; }
|
|
403
|
+
root="${RUNNER_TEMP%/*}/_norsk-ctl-gcroot/${GITHUB_REPOSITORY//\//_}"
|
|
404
|
+
if [ -L "$root" ] && [ ! -e "$root" ]; then
|
|
405
|
+
echo "::warning::norsk-ctl's GC root $root dangled since the last job here: the host's nix GC did not see it, so this runner's work dir is probably not at the same path on the host as in the container (id3as/jankings)"
|
|
406
|
+
fi
|
|
407
|
+
nix build .#norsk-ctl --out-link "$root" || {
|
|
408
|
+
echo "::error::.#norsk-ctl failed to build; if ctlVersion was edited by hand, refresh the hashes (bump.yml does it nightly; id3as/norsk-ctl packages/dev-kit/build/refresh-ctl-pin.sh by hand)"
|
|
409
|
+
exit 1
|
|
410
|
+
}
|
|
411
|
+
install -m 755 "$root/bin/norsk-ctl" "$RUNNER_TEMP/norsk-ctl"
|
|
412
|
+
echo "norsk-ctl from flake package $(readlink "$root")"
|
|
413
|
+
fetched=nix
|
|
414
|
+
elif grep -q "does not provide attribute" "$RUNNER_TEMP/ctl-eval.err"; then
|
|
415
|
+
echo "flake has no norsk-ctl package ($(grep -m1 "does not provide attribute" "$RUNNER_TEMP/ctl-eval.err")); fetching $ver from S3"
|
|
416
|
+
else
|
|
417
|
+
cat "$RUNNER_TEMP/ctl-eval.err" >&2
|
|
418
|
+
exit 1
|
|
419
|
+
fi
|
|
420
|
+
fi
|
|
421
|
+
if [ "$fetched" = s3 ]; then
|
|
422
|
+
curl -fsSL --retry 3 --retry-all-errors --retry-delay 2 "$S3/$ver/norsk-ctl-$ver-$arch" -o "$RUNNER_TEMP/norsk-ctl"
|
|
423
|
+
chmod +x "$RUNNER_TEMP/norsk-ctl"
|
|
391
424
|
fi
|
|
392
|
-
curl -fsSL --retry 3 --retry-all-errors --retry-delay 2 "$S3/$ver/norsk-ctl-$ver-$arch" -o "$RUNNER_TEMP/norsk-ctl"
|
|
393
|
-
chmod +x "$RUNNER_TEMP/norsk-ctl"
|
|
394
425
|
"$RUNNER_TEMP/norsk-ctl" --version
|
|
395
426
|
|
|
396
427
|
# Everything below runs dev-kit and test-harness code out of node_modules,
|
|
@@ -220,8 +220,39 @@ jobs:
|
|
|
220
220
|
ver="$( { sed -nE 's/^[[:space:]]*ctlVersion = "([^"]+)";.*/\1/p' flake.nix 2>/dev/null || true; } | head -1)"
|
|
221
221
|
[ -n "$ver" ] || { echo "::error::flake.nix pins no ctlVersion. CI runs the norsk-ctl this commit pins (the nightly bump.yml moves it); add ctlVersion = \"<version>\"; to flake.nix."; exit 1; }
|
|
222
222
|
echo "norsk-ctl pinned by flake.nix ctlVersion -> $ver"
|
|
223
|
-
|
|
224
|
-
|
|
223
|
+
fetched=s3
|
|
224
|
+
# The flake's norsk-ctl package is this same pin (ctlVersion + hash): the
|
|
225
|
+
# runner's nix store fetches a version once, rooted per repo under _work
|
|
226
|
+
# (RUNNER_TEMP is wiped every job). Copied out, not linked: ctl keys its
|
|
227
|
+
# asset extraction on its own mtime, and every store path's is 1. A flake
|
|
228
|
+
# with no such package (an sdk-app's) takes the pin from S3.
|
|
229
|
+
# The host GCs its /nix (the runner containers share it): the root guards
|
|
230
|
+
# the path only because every runner taking these jobs has its work dir at
|
|
231
|
+
# the same path on the host as in the container (id3as/jankings).
|
|
232
|
+
# A renamed or deleted repo's root stays behind: bounded, one version each.
|
|
233
|
+
if pkg="$(nix eval --raw .#norsk-ctl.version 2>"$RUNNER_TEMP/ctl-eval.err")"; then
|
|
234
|
+
[ "$pkg" = "$ver" ] || { echo "::error::flake.nix's norsk-ctl package is $pkg, not its ctlVersion $ver"; exit 1; }
|
|
235
|
+
root="${RUNNER_TEMP%/*}/_norsk-ctl-gcroot/${GITHUB_REPOSITORY//\//_}"
|
|
236
|
+
if [ -L "$root" ] && [ ! -e "$root" ]; then
|
|
237
|
+
echo "::warning::norsk-ctl's GC root $root dangled since the last job here: the host's nix GC did not see it, so this runner's work dir is probably not at the same path on the host as in the container (id3as/jankings)"
|
|
238
|
+
fi
|
|
239
|
+
nix build .#norsk-ctl --out-link "$root" || {
|
|
240
|
+
echo "::error::.#norsk-ctl failed to build; if ctlVersion was edited by hand, refresh the hashes (bump.yml does it nightly; id3as/norsk-ctl packages/dev-kit/build/refresh-ctl-pin.sh by hand)"
|
|
241
|
+
exit 1
|
|
242
|
+
}
|
|
243
|
+
install -m 755 "$root/bin/norsk-ctl" "$RUNNER_TEMP/norsk-ctl"
|
|
244
|
+
echo "norsk-ctl from flake package $(readlink "$root")"
|
|
245
|
+
fetched=nix
|
|
246
|
+
elif grep -q "does not provide attribute" "$RUNNER_TEMP/ctl-eval.err"; then
|
|
247
|
+
echo "flake has no norsk-ctl package ($(grep -m1 "does not provide attribute" "$RUNNER_TEMP/ctl-eval.err")); fetching $ver from S3"
|
|
248
|
+
else
|
|
249
|
+
cat "$RUNNER_TEMP/ctl-eval.err" >&2
|
|
250
|
+
exit 1
|
|
251
|
+
fi
|
|
252
|
+
if [ "$fetched" = s3 ]; then
|
|
253
|
+
curl -fsSL --retry 3 --retry-all-errors --retry-delay 2 "$S3/$ver/norsk-ctl-$ver-linux-x64" -o "$RUNNER_TEMP/norsk-ctl"
|
|
254
|
+
chmod +x "$RUNNER_TEMP/norsk-ctl"
|
|
255
|
+
fi
|
|
225
256
|
"$RUNNER_TEMP/norsk-ctl" --version || true
|
|
226
257
|
|
|
227
258
|
# Cold-runner first pulls overrun the harness's per-test launch timeouts;
|
package/conventions/smoke.yml
CHANGED
|
@@ -249,6 +249,7 @@ jobs:
|
|
|
249
249
|
*) echo "unsupported runner arch: $(uname -m)" >&2; exit 1 ;;
|
|
250
250
|
esac
|
|
251
251
|
S3="https://s3.eu-west-1.amazonaws.com/norsk.video/norsk-ctl"
|
|
252
|
+
fetched=s3
|
|
252
253
|
if [ -n "${CTL_CHANNEL:-}" ]; then
|
|
253
254
|
ver="$(curl -fsSL --retry 3 --retry-all-errors --retry-delay 2 "$S3/$CTL_CHANNEL")"
|
|
254
255
|
echo "norsk-ctl $CTL_CHANNEL channel -> $ver ($arch), in place of the repo pin"
|
|
@@ -256,9 +257,39 @@ jobs:
|
|
|
256
257
|
ver="$( { sed -nE 's/^[[:space:]]*ctlVersion = "([^"]+)";.*/\1/p' flake.nix 2>/dev/null || true; } | head -1)"
|
|
257
258
|
[ -n "$ver" ] || { echo "::error::flake.nix pins no ctlVersion. CI runs the norsk-ctl this commit pins (the nightly bump.yml moves it); add ctlVersion = \"<version>\"; to flake.nix."; exit 1; }
|
|
258
259
|
echo "norsk-ctl pinned by flake.nix ctlVersion -> $ver ($arch)"
|
|
260
|
+
# The flake's norsk-ctl package is this same pin (ctlVersion + hash): the
|
|
261
|
+
# runner's nix store fetches a version once, rooted per repo under _work
|
|
262
|
+
# (RUNNER_TEMP is wiped every job). Copied out, not linked: ctl keys its
|
|
263
|
+
# asset extraction on its own mtime, and every store path's is 1. A flake
|
|
264
|
+
# with no such package (an sdk-app's) takes the pin from S3.
|
|
265
|
+
# The host GCs its /nix (the runner containers share it): the root guards
|
|
266
|
+
# the path only because every runner taking these jobs has its work dir at
|
|
267
|
+
# the same path on the host as in the container (id3as/jankings).
|
|
268
|
+
# A renamed or deleted repo's root stays behind: bounded, one version each.
|
|
269
|
+
if pkg="$(nix eval --raw .#norsk-ctl.version 2>"$RUNNER_TEMP/ctl-eval.err")"; then
|
|
270
|
+
[ "$pkg" = "$ver" ] || { echo "::error::flake.nix's norsk-ctl package is $pkg, not its ctlVersion $ver"; exit 1; }
|
|
271
|
+
root="${RUNNER_TEMP%/*}/_norsk-ctl-gcroot/${GITHUB_REPOSITORY//\//_}"
|
|
272
|
+
if [ -L "$root" ] && [ ! -e "$root" ]; then
|
|
273
|
+
echo "::warning::norsk-ctl's GC root $root dangled since the last job here: the host's nix GC did not see it, so this runner's work dir is probably not at the same path on the host as in the container (id3as/jankings)"
|
|
274
|
+
fi
|
|
275
|
+
nix build .#norsk-ctl --out-link "$root" || {
|
|
276
|
+
echo "::error::.#norsk-ctl failed to build; if ctlVersion was edited by hand, refresh the hashes (bump.yml does it nightly; id3as/norsk-ctl packages/dev-kit/build/refresh-ctl-pin.sh by hand)"
|
|
277
|
+
exit 1
|
|
278
|
+
}
|
|
279
|
+
install -m 755 "$root/bin/norsk-ctl" "$RUNNER_TEMP/norsk-ctl"
|
|
280
|
+
echo "norsk-ctl from flake package $(readlink "$root")"
|
|
281
|
+
fetched=nix
|
|
282
|
+
elif grep -q "does not provide attribute" "$RUNNER_TEMP/ctl-eval.err"; then
|
|
283
|
+
echo "flake has no norsk-ctl package ($(grep -m1 "does not provide attribute" "$RUNNER_TEMP/ctl-eval.err")); fetching $ver from S3"
|
|
284
|
+
else
|
|
285
|
+
cat "$RUNNER_TEMP/ctl-eval.err" >&2
|
|
286
|
+
exit 1
|
|
287
|
+
fi
|
|
288
|
+
fi
|
|
289
|
+
if [ "$fetched" = s3 ]; then
|
|
290
|
+
curl -fsSL --retry 3 --retry-all-errors --retry-delay 2 "$S3/$ver/norsk-ctl-$ver-$arch" -o "$RUNNER_TEMP/norsk-ctl"
|
|
291
|
+
chmod +x "$RUNNER_TEMP/norsk-ctl"
|
|
259
292
|
fi
|
|
260
|
-
curl -fsSL --retry 3 --retry-all-errors --retry-delay 2 "$S3/$ver/norsk-ctl-$ver-$arch" -o "$RUNNER_TEMP/norsk-ctl"
|
|
261
|
-
chmod +x "$RUNNER_TEMP/norsk-ctl"
|
|
262
293
|
"$RUNNER_TEMP/norsk-ctl" --version
|
|
263
294
|
|
|
264
295
|
# Everything below runs dev-kit and test-harness code out of node_modules,
|