@norskvideo/ctl-dev-kit 0.2.121 → 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.
- package/build/refresh-ctl-pin.sh +6 -5
- package/conventions/build-docs.yml +33 -2
- package/conventions/build-image.yml +66 -4
- package/conventions/bump.sdk-app.yml +4 -4
- package/conventions/bump.yml +6 -5
- package/conventions/check-drift.ts +22 -0
- package/conventions/integration.yml +33 -2
- package/conventions/publish-docs.yml +33 -2
- package/conventions/smoke.yml +33 -2
- package/package.json +1 -1
package/build/refresh-ctl-pin.sh
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# Repin the norsk-ctl daemon in flake.nix to a channel version. Resolves the
|
|
3
|
-
# version (default: the `
|
|
4
|
-
# sidecar, converts to SRI, and
|
|
5
|
-
#
|
|
3
|
+
# version (default: the `rc` channel, which the products' nightly bump
|
|
4
|
+
# follows), fetches each platform's sha256 sidecar, converts to SRI, and
|
|
5
|
+
# rewrites `ctlVersion` + the four `hash =` lines in flake.nix in place. Run
|
|
6
|
+
# from anywhere; targets the flake.nix beside it.
|
|
6
7
|
#
|
|
7
|
-
# refresh-ctl-pin.sh # pin to the current `
|
|
8
|
+
# refresh-ctl-pin.sh # pin to the current `rc`
|
|
8
9
|
# refresh-ctl-pin.sh 0.1.0-2026-07-27-... # pin to an explicit version
|
|
9
10
|
set -euo pipefail
|
|
10
11
|
|
|
@@ -12,7 +13,7 @@ here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
12
13
|
flake="$here/flake.nix"
|
|
13
14
|
base="https://s3.eu-west-1.amazonaws.com/norsk.video/norsk-ctl"
|
|
14
15
|
|
|
15
|
-
ver="${1:-$(curl -fsSL "$base/
|
|
16
|
+
ver="${1:-$(curl -fsSL "$base/rc")}"
|
|
16
17
|
echo "pinning norsk-ctl -> $ver"
|
|
17
18
|
|
|
18
19
|
declare -A plat=(
|
|
@@ -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
|
|
@@ -21,7 +21,7 @@ on:
|
|
|
21
21
|
schedule:
|
|
22
22
|
- cron: "17 4 * * *"
|
|
23
23
|
# Sent, through ci-workflows' fan-out, when something this repo pins is
|
|
24
|
-
# published (the norsk nightly, Studio's manifest pair, norsk-ctl
|
|
24
|
+
# published (the norsk nightly, Studio's manifest pair, norsk-ctl rc), so
|
|
25
25
|
# the pins move the same day rather than at the next 04:17. client_payload
|
|
26
26
|
# may name components; it defaults to the pins.
|
|
27
27
|
repository_dispatch:
|
|
@@ -285,7 +285,7 @@ jobs:
|
|
|
285
285
|
# Then every occurrence of the old string moves, lockfile aside --
|
|
286
286
|
# including the engine image ref the product's template launches. It also
|
|
287
287
|
# moves flake.nix's ctlVersion, the norsk-ctl the product's CI tiers run,
|
|
288
|
-
# to the `
|
|
288
|
+
# to the `rc` channel (ctl-pinned-in-repo.test.ts).
|
|
289
289
|
#
|
|
290
290
|
# A REFUSAL refuses the pins alone: the step says why and moves nothing,
|
|
291
291
|
# and the night's other components still reach their PR.
|
|
@@ -311,8 +311,8 @@ jobs:
|
|
|
311
311
|
ctl_base="https://s3.eu-west-1.amazonaws.com/norsk.video/norsk-ctl"
|
|
312
312
|
old_ctl="$( { grep -oE 'ctlVersion = "[^"]+"' flake.nix 2>/dev/null || true; } | head -1 | sed -E 's/.*"(.*)"/\1/')"
|
|
313
313
|
[ -n "$old_ctl" ] || refuse "flake.nix pins no ctlVersion. CI runs the norsk-ctl it names, so add ctlVersion = \"<version>\"; to flake.nix."
|
|
314
|
-
new_ctl="$(curl -fsSL --retry 3 --retry-all-errors --retry-delay 2 "$ctl_base/
|
|
315
|
-
[ -n "$new_ctl" ] || refuse "could not resolve norsk-ctl's
|
|
314
|
+
new_ctl="$(curl -fsSL --retry 3 --retry-all-errors --retry-delay 2 "$ctl_base/rc" || true)"
|
|
315
|
+
[ -n "$new_ctl" ] || refuse "could not resolve norsk-ctl's rc channel"
|
|
316
316
|
# An sdk-app's flake fetches no daemon, so normally no hashes; any
|
|
317
317
|
# platform it does fetch is resolved now, before anything moves.
|
|
318
318
|
declare -A ctl_sri=()
|
package/conventions/bump.yml
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
# 2. ctl-packages: the @norskvideo/ctl-* and moq-* family to npm `latest`;
|
|
7
7
|
# 3. pins: the engine and Studio image pair from the nightly entry of
|
|
8
8
|
# norsk-studio's channel manifest, and flake.nix's norsk-ctl pin to the
|
|
9
|
-
# `
|
|
9
|
+
# `rc` channel (hourly builds of main that passed ctl's release checks;
|
|
10
|
+
# `latest` moves only when ctl is blessed).
|
|
10
11
|
# Then ONE lockfile refresh across every install root, the quick gate (drift,
|
|
11
12
|
# lint, typecheck, unit), and ONE PR on bump/nightly, force-pushed, listing
|
|
12
13
|
# every component that moved, from and to, and anything refused, and why.
|
|
@@ -45,7 +46,7 @@ on:
|
|
|
45
46
|
schedule:
|
|
46
47
|
- cron: "17 4 * * *"
|
|
47
48
|
# Sent, through ci-workflows' fan-out, when something this repo pins is
|
|
48
|
-
# published (the norsk nightly, Studio's manifest pair, norsk-ctl
|
|
49
|
+
# published (the norsk nightly, Studio's manifest pair, norsk-ctl rc), so
|
|
49
50
|
# the pins move the same day rather than at the next 04:17. client_payload
|
|
50
51
|
# may name components; it defaults to the pins.
|
|
51
52
|
repository_dispatch:
|
|
@@ -301,7 +302,7 @@ jobs:
|
|
|
301
302
|
# PINS last: the {engine, studio image} pair from the nightly entry of
|
|
302
303
|
# norsk-studio's channel manifest -- the pair studio TESTED together --
|
|
303
304
|
# never from the two channels separately, plus flake.nix's norsk-ctl pin
|
|
304
|
-
# (ctlVersion + the per-platform hashes) to the `
|
|
305
|
+
# (ctlVersion + the per-platform hashes) to the `rc` channel. That pin
|
|
305
306
|
# is not dev-only: every CI tier runs the norsk-ctl it names, so a
|
|
306
307
|
# product's result belongs to a commit (ctl-pinned-in-repo.test.ts).
|
|
307
308
|
# Version discovery anchors on manifest.seed.json (the machine-writable
|
|
@@ -339,8 +340,8 @@ jobs:
|
|
|
339
340
|
ctl_base="https://s3.eu-west-1.amazonaws.com/norsk.video/norsk-ctl"
|
|
340
341
|
old_ctl="$( { grep -oE 'ctlVersion = "[^"]+"' flake.nix 2>/dev/null || true; } | head -1 | sed -E 's/.*"(.*)"/\1/')"
|
|
341
342
|
[ -n "$old_ctl" ] || refuse "flake.nix pins no ctlVersion. CI runs the norsk-ctl it names, so add ctlVersion = \"<version>\"; to flake.nix."
|
|
342
|
-
new_ctl="$(curl -fsSL --retry 3 --retry-all-errors --retry-delay 2 "$ctl_base/
|
|
343
|
-
[ -n "$new_ctl" ] || refuse "could not resolve norsk-ctl's
|
|
343
|
+
new_ctl="$(curl -fsSL --retry 3 --retry-all-errors --retry-delay 2 "$ctl_base/rc" || true)"
|
|
344
|
+
[ -n "$new_ctl" ] || refuse "could not resolve norsk-ctl's rc channel"
|
|
344
345
|
# The per-platform hash of each platform the flake fetches the daemon
|
|
345
346
|
# for (a Studio product's flake fetches all four; an sdk-app's none).
|
|
346
347
|
# Fetched now, not after the engine has moved: a missing sidecar used
|
|
@@ -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,
|