@norskvideo/ctl-dev-kit 0.1.76 → 0.1.77
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.
|
@@ -10,12 +10,18 @@
|
|
|
10
10
|
# norsk-ctl daemon to the `latest` channel (dev-only; CI downloads ctl
|
|
11
11
|
# directly, so a stale pin never affects CI or customers).
|
|
12
12
|
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
13
|
+
# Nightly cron + on demand. The bump runs the product's own gate (lint,
|
|
14
|
+
# typecheck, unit tests) BEFORE it lands, exactly as sync-dev-kit does: green
|
|
15
|
+
# lands on main, red opens a reconciliation PR and main stays green.
|
|
16
|
+
#
|
|
17
|
+
# It used to commit straight to main and rely on the push-triggered run for its
|
|
18
|
+
# verdict. The push is made with CI_DISPATCH_TOKEN (a PAT), so that run really
|
|
19
|
+
# does happen -- a GITHUB_TOKEN push would fire nothing (Actions' recursion
|
|
20
|
+
# guard) -- but it makes a RED `main` the alarm, and nobody watches a product
|
|
21
|
+
# repo's own `main`: playout sat red ~12h, then funke, then probe, inside three
|
|
22
|
+
# days (fleet review 04c, class 8). Gating first turns "a bad Norsk nightly reds
|
|
23
|
+
# six repos overnight" into "a bad Norsk nightly opens a PR that says so".
|
|
24
|
+
# Pinned for the class by conventions/gate-before-main.test.ts.
|
|
19
25
|
#
|
|
20
26
|
# Single-sourced in @norskvideo/ctl-dev-kit (conventions/upgrade-latest.yml) and
|
|
21
27
|
# copied verbatim into each product repo; the check:drift gate fails CI if a copy
|
|
@@ -202,8 +208,23 @@ jobs:
|
|
|
202
208
|
done
|
|
203
209
|
'
|
|
204
210
|
|
|
205
|
-
- name:
|
|
211
|
+
- name: Run the product gate against the bumped pins
|
|
212
|
+
id: gate
|
|
206
213
|
if: steps.bump.outputs.changed == '1'
|
|
214
|
+
# continue-on-error so a red gate can open a PR below instead of failing
|
|
215
|
+
# the workflow -- which is why the steps after it read `outcome` and not
|
|
216
|
+
# `conclusion` (continue-on-error rewrites conclusion to success).
|
|
217
|
+
continue-on-error: true
|
|
218
|
+
run: |
|
|
219
|
+
nix develop .#build --command bash -c '
|
|
220
|
+
set -euo pipefail
|
|
221
|
+
bun run lint
|
|
222
|
+
bun run typecheck
|
|
223
|
+
bun run test:unit
|
|
224
|
+
'
|
|
225
|
+
|
|
226
|
+
- name: Land the bump on main (gate green)
|
|
227
|
+
if: steps.bump.outputs.changed == '1' && steps.gate.outcome == 'success'
|
|
207
228
|
run: |
|
|
208
229
|
set -euo pipefail
|
|
209
230
|
git config user.name "github-actions[bot]"
|
|
@@ -230,6 +251,55 @@ jobs:
|
|
|
230
251
|
done
|
|
231
252
|
echo "push still failing after 5 rebase attempts"; exit 1
|
|
232
253
|
|
|
254
|
+
- name: Open a reconciliation PR (gate red)
|
|
255
|
+
if: steps.bump.outputs.changed == '1' && steps.gate.outcome == 'failure'
|
|
256
|
+
env:
|
|
257
|
+
API_TOKEN: ${{ secrets.CI_DISPATCH_TOKEN }}
|
|
258
|
+
run: |
|
|
259
|
+
set -euo pipefail
|
|
260
|
+
branch="upgrade-latest/nightly"
|
|
261
|
+
git config user.name "github-actions[bot]"
|
|
262
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
263
|
+
git checkout -b "$branch"
|
|
264
|
+
git add -A
|
|
265
|
+
git commit -m "chore: bump Norsk nightly + ctl pins to latest channel (needs reconciliation)
|
|
266
|
+
|
|
267
|
+
${{ steps.bump.outputs.summary }}"
|
|
268
|
+
git push -f origin "$branch"
|
|
269
|
+
title="Bump Norsk nightly + ctl pins to latest channel"
|
|
270
|
+
body="$(printf '%s\n' \
|
|
271
|
+
"Automated nightly pin bump: the Norsk nightly channel moved and the coupled" \
|
|
272
|
+
"pins came with it -- but the product gate is **red**, so this bump needs a" \
|
|
273
|
+
"human before it reaches main." \
|
|
274
|
+
"" \
|
|
275
|
+
" ${{ steps.bump.outputs.summary }}" \
|
|
276
|
+
"" \
|
|
277
|
+
"A red gate here usually means the new Norsk nightly is bad, or genuinely" \
|
|
278
|
+
"changed something the product depends on. Run it to see which:" \
|
|
279
|
+
"" \
|
|
280
|
+
" bun run lint && bun run typecheck && bun run test:unit" \
|
|
281
|
+
"" \
|
|
282
|
+
"Fix it on this branch and merge, or close this PR to skip the bump -- the" \
|
|
283
|
+
"next nightly run reopens it against whatever the channel holds then.")"
|
|
284
|
+
# gh is not on the self-hosted runner PATH (it lives only inside
|
|
285
|
+
# `nix develop`, and this step runs outside it), so create/update the PR
|
|
286
|
+
# straight against the REST API with the same PAT that pushed the branch.
|
|
287
|
+
# The PAT (not GITHUB_TOKEN) is what lets the PR's own checks run, which
|
|
288
|
+
# is the whole point: the bump is judged before it lands, not after.
|
|
289
|
+
repo="${{ github.repository }}"; owner="${repo%%/*}"
|
|
290
|
+
api="https://api.github.com/repos/$repo/pulls"
|
|
291
|
+
curl_api=(--fail-with-body -sS -H "Authorization: Bearer $API_TOKEN" -H "Accept: application/vnd.github+json")
|
|
292
|
+
existing="$(curl "${curl_api[@]}" "$api?head=$owner:$branch&state=open" | jq -r '.[0].number // empty')"
|
|
293
|
+
if [ -n "$existing" ]; then
|
|
294
|
+
curl "${curl_api[@]}" -X PATCH "$api/$existing" \
|
|
295
|
+
--data "$(jq -nc --arg t "$title" --arg b "$body" '{title:$t, body:$b}')" > /dev/null
|
|
296
|
+
echo "updated PR #$existing"
|
|
297
|
+
else
|
|
298
|
+
curl "${curl_api[@]}" -X POST "$api" \
|
|
299
|
+
--data "$(jq -nc --arg t "$title" --arg b "$body" --arg h "$branch" \
|
|
300
|
+
'{title:$t, body:$b, head:$h, base:"main"}')" | jq -r '"opened PR #\(.number)"'
|
|
301
|
+
fi
|
|
302
|
+
|
|
233
303
|
- name: Report "already fresh"
|
|
234
304
|
if: steps.bump.outputs.changed != '1'
|
|
235
305
|
run: echo "Nightly pins already current — nothing to bump."
|