@futurelastic/colab-handbook 1.12.0-rc.12 → 1.12.0-rc.14
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/audit/audit.mjs +4 -2
- package/package.json +1 -1
- package/templates/ci-laravel.yml +25 -0
- package/templates/ci-node.yml +26 -0
- package/templates/ci-python.yml +26 -0
- package/templates/release-auto.yml +23 -3
package/audit/audit.mjs
CHANGED
|
@@ -1270,12 +1270,14 @@ function auditRepo(target, ctx) {
|
|
|
1270
1270
|
// ---- ship-batch (#373) ------------------------------------------------------
|
|
1271
1271
|
// Batch landing's opt-in: an integer 1–3 (tools/lib/ship-batch.js parseShipBatch — the one reading
|
|
1272
1272
|
// `colab ship --batch` uses, so the two cannot disagree). A malformed value makes ship fail closed
|
|
1273
|
-
// to serial, which is safe but silent, so it fails here
|
|
1273
|
+
// to serial, which is safe but silent, so it fails here — and, since this audit is run by hand, in
|
|
1274
|
+
// the CI templates' descriptor check too (#416, held to this same parser by
|
|
1275
|
+
// tools/lib/ci-template-descriptor-check.test.js). Two further shapes are inert rather than
|
|
1274
1276
|
// wrong, so they warn: no workflow fires on a `ship-batch/**` push (the combined run can never
|
|
1275
1277
|
// arrive), and no `autonomy: auto-trunk` (a batch lands in one unattended push, which needs it).
|
|
1276
1278
|
if ("ship-batch" in (cfg || {}) && cfg["ship-batch"] !== null) {
|
|
1277
1279
|
const sbCfg = shipBatch.parseShipBatch(cfg);
|
|
1278
|
-
if (!sbCfg.valid) fail(sbCfg.reason);
|
|
1280
|
+
if (!sbCfg.valid) fail(`${sbCfg.reason} — the cap is deliberate, see project.schema.md, ship-batch`);
|
|
1279
1281
|
else if (sbCfg.n > 1) {
|
|
1280
1282
|
const firing = workflowsFiringOnBranchPush({ readFile: (p) => src.readFile(p), workflows, branch: shipBatch.PROBE_REF });
|
|
1281
1283
|
if (!firing.length) warn(`ship-batch: ${sbCfg.n} but no workflow in .github/workflows fires on a push to ship-batch/** — colab ship --batch will always fall back to serial; add 'ship-batch/**' to a CI workflow's push: branches:`);
|
package/package.json
CHANGED
package/templates/ci-laravel.yml
CHANGED
|
@@ -154,6 +154,31 @@ jobs:
|
|
|
154
154
|
with:
|
|
155
155
|
persist-credentials: false
|
|
156
156
|
|
|
157
|
+
# ---------------------------------------------------------------------------
|
|
158
|
+
# Descriptor check (#416). A value `colab ship` cannot use does not fail there —
|
|
159
|
+
# it fails closed to the safe default, silently. `ship-batch: 5` (the cap is 3)
|
|
160
|
+
# once turned every landing in a busy repo back to serial while this CI stayed
|
|
161
|
+
# green; only a ship dry run noticed. So the value fails HERE, where the person
|
|
162
|
+
# who changed project.yml is looking. Same rule as `colab ship` and the audit
|
|
163
|
+
# (tools/lib/ship-batch.js parseShipBatch): absent/empty/null, or 1–3. Why the
|
|
164
|
+
# cap is 3: project.schema.md, `ship-batch`.
|
|
165
|
+
# ---------------------------------------------------------------------------
|
|
166
|
+
- name: Descriptor check (.github/project.yml)
|
|
167
|
+
working-directory: ${{ github.workspace }}
|
|
168
|
+
run: |
|
|
169
|
+
[ -f .github/project.yml ] || exit 0
|
|
170
|
+
line="$(grep -E '^ship-batch[[:space:]]*:' .github/project.yml | head -1 || true)"
|
|
171
|
+
[ -n "$line" ] || exit 0
|
|
172
|
+
v="$(printf '%s\n' "$line" | sed -E -e 's/^ship-batch[[:space:]]*:[[:space:]]*//' \
|
|
173
|
+
-e 's/[[:space:]]+#.*$//' -e 's/[[:space:]]+$//' \
|
|
174
|
+
-e 's/^"(.*)"$/\1/' -e "s/^'(.*)'\$/\\1/")"
|
|
175
|
+
case "$v" in
|
|
176
|
+
''|'~'|null|1|2|3) echo "ship-batch: ${v:-absent} — ok" ;;
|
|
177
|
+
*)
|
|
178
|
+
echo "::error file=.github/project.yml::ship-batch is '$v', expected an integer 1-3 (omit for serial). colab ship ignores any other value and lands serially. Why the cap is 3: project.schema.md, ship-batch."
|
|
179
|
+
exit 1 ;;
|
|
180
|
+
esac
|
|
181
|
+
|
|
157
182
|
# ---------------------------------------------------------------------------
|
|
158
183
|
# Toolchain resolution. Precedence, highest first:
|
|
159
184
|
# PHP : 1. .github/project.yml -> php: 2. composer.json -> require.php
|
package/templates/ci-node.yml
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
# `php artisan wayfinder:generate` and needs PHP on the runner. Use ci-laravel.yml.
|
|
14
14
|
#
|
|
15
15
|
# What it does:
|
|
16
|
+
# 0. Fail on a .github/project.yml value colab would silently ignore (ship-batch, #416).
|
|
16
17
|
# 1. Resolve the Node version from declared sources — never a hardcoded default.
|
|
17
18
|
# 2. Secret scan with gitleaks (pinned release binary, see note at the step).
|
|
18
19
|
# 3. Install dependencies with the package manager the lockfile implies.
|
|
@@ -147,6 +148,31 @@ jobs:
|
|
|
147
148
|
with:
|
|
148
149
|
persist-credentials: false
|
|
149
150
|
|
|
151
|
+
# ---------------------------------------------------------------------------
|
|
152
|
+
# Descriptor check (#416). A value `colab ship` cannot use does not fail there —
|
|
153
|
+
# it fails closed to the safe default, silently. `ship-batch: 5` (the cap is 3)
|
|
154
|
+
# once turned every landing in a busy repo back to serial while this CI stayed
|
|
155
|
+
# green; only a ship dry run noticed. So the value fails HERE, where the person
|
|
156
|
+
# who changed project.yml is looking. Same rule as `colab ship` and the audit
|
|
157
|
+
# (tools/lib/ship-batch.js parseShipBatch): absent/empty/null, or 1–3. Why the
|
|
158
|
+
# cap is 3: project.schema.md, `ship-batch`.
|
|
159
|
+
# ---------------------------------------------------------------------------
|
|
160
|
+
- name: Descriptor check (.github/project.yml)
|
|
161
|
+
working-directory: ${{ github.workspace }}
|
|
162
|
+
run: |
|
|
163
|
+
[ -f .github/project.yml ] || exit 0
|
|
164
|
+
line="$(grep -E '^ship-batch[[:space:]]*:' .github/project.yml | head -1 || true)"
|
|
165
|
+
[ -n "$line" ] || exit 0
|
|
166
|
+
v="$(printf '%s\n' "$line" | sed -E -e 's/^ship-batch[[:space:]]*:[[:space:]]*//' \
|
|
167
|
+
-e 's/[[:space:]]+#.*$//' -e 's/[[:space:]]+$//' \
|
|
168
|
+
-e 's/^"(.*)"$/\1/' -e "s/^'(.*)'\$/\\1/")"
|
|
169
|
+
case "$v" in
|
|
170
|
+
''|'~'|null|1|2|3) echo "ship-batch: ${v:-absent} — ok" ;;
|
|
171
|
+
*)
|
|
172
|
+
echo "::error file=.github/project.yml::ship-batch is '$v', expected an integer 1-3 (omit for serial). colab ship ignores any other value and lands serially. Why the cap is 3: project.schema.md, ship-batch."
|
|
173
|
+
exit 1 ;;
|
|
174
|
+
esac
|
|
175
|
+
|
|
150
176
|
# ---------------------------------------------------------------------------
|
|
151
177
|
# Toolchain resolution. Precedence, highest first:
|
|
152
178
|
# 1. .github/project.yml -> node: <version>
|
package/templates/ci-python.yml
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
# NOT for: Laravel + Inertia fullstack apps — use ci-laravel.yml.
|
|
28
28
|
#
|
|
29
29
|
# What it does:
|
|
30
|
+
# 0. Fail on a .github/project.yml value colab would silently ignore (ship-batch, #416).
|
|
30
31
|
# 1. Resolve the Python version from declared sources — never a hardcoded default.
|
|
31
32
|
# 2. Secret scan with gitleaks (pinned release binary, see note at the step).
|
|
32
33
|
# 3. Install dependencies from whichever manifest the repo actually has.
|
|
@@ -138,6 +139,31 @@ jobs:
|
|
|
138
139
|
with:
|
|
139
140
|
persist-credentials: false
|
|
140
141
|
|
|
142
|
+
# ---------------------------------------------------------------------------
|
|
143
|
+
# Descriptor check (#416). A value `colab ship` cannot use does not fail there —
|
|
144
|
+
# it fails closed to the safe default, silently. `ship-batch: 5` (the cap is 3)
|
|
145
|
+
# once turned every landing in a busy repo back to serial while this CI stayed
|
|
146
|
+
# green; only a ship dry run noticed. So the value fails HERE, where the person
|
|
147
|
+
# who changed project.yml is looking. Same rule as `colab ship` and the audit
|
|
148
|
+
# (tools/lib/ship-batch.js parseShipBatch): absent/empty/null, or 1–3. Why the
|
|
149
|
+
# cap is 3: project.schema.md, `ship-batch`.
|
|
150
|
+
# ---------------------------------------------------------------------------
|
|
151
|
+
- name: Descriptor check (.github/project.yml)
|
|
152
|
+
working-directory: ${{ github.workspace }}
|
|
153
|
+
run: |
|
|
154
|
+
[ -f .github/project.yml ] || exit 0
|
|
155
|
+
line="$(grep -E '^ship-batch[[:space:]]*:' .github/project.yml | head -1 || true)"
|
|
156
|
+
[ -n "$line" ] || exit 0
|
|
157
|
+
v="$(printf '%s\n' "$line" | sed -E -e 's/^ship-batch[[:space:]]*:[[:space:]]*//' \
|
|
158
|
+
-e 's/[[:space:]]+#.*$//' -e 's/[[:space:]]+$//' \
|
|
159
|
+
-e 's/^"(.*)"$/\1/' -e "s/^'(.*)'\$/\\1/")"
|
|
160
|
+
case "$v" in
|
|
161
|
+
''|'~'|null|1|2|3) echo "ship-batch: ${v:-absent} — ok" ;;
|
|
162
|
+
*)
|
|
163
|
+
echo "::error file=.github/project.yml::ship-batch is '$v', expected an integer 1-3 (omit for serial). colab ship ignores any other value and lands serially. Why the cap is 3: project.schema.md, ship-batch."
|
|
164
|
+
exit 1 ;;
|
|
165
|
+
esac
|
|
166
|
+
|
|
141
167
|
# ---------------------------------------------------------------------------
|
|
142
168
|
# Toolchain resolution. Precedence, highest first:
|
|
143
169
|
# 1. .github/project.yml -> python: <version>
|
|
@@ -137,8 +137,11 @@ env:
|
|
|
137
137
|
jobs:
|
|
138
138
|
release:
|
|
139
139
|
name: Cut, finalize, publish
|
|
140
|
-
#
|
|
141
|
-
|
|
140
|
+
# No job-level `if:` here, on purpose (#435): a red CI run is gated in the first step below,
|
|
141
|
+
# so this run concludes success. A job-level `if:` would skip every job, GitHub would record
|
|
142
|
+
# the whole run as `skipped` at that main sha, and `colab ship` reads any finished run that is
|
|
143
|
+
# neither success nor cancelled as "not green". Re-run CI green on that sha and the skipped
|
|
144
|
+
# Release (auto) row would still sit beside it, refusing every ship until main moves.
|
|
142
145
|
runs-on: ubuntu-latest # EDIT: self-hosted label if this repo needs one.
|
|
143
146
|
permissions:
|
|
144
147
|
contents: write # push the tags (and, with promotion: main-loop, the promotion), publish the GitHub Release
|
|
@@ -165,6 +168,23 @@ jobs:
|
|
|
165
168
|
# checkout's origin. The token is this job's, scoped by `permissions:` above.
|
|
166
169
|
persist-credentials: true
|
|
167
170
|
|
|
171
|
+
# A red CI run on main is not a candidate. Gated here rather than by a job-level `if:` so
|
|
172
|
+
# this run concludes success, never `skipped` (#435; the comment on the job above).
|
|
173
|
+
- name: Gate on the triggering CI run
|
|
174
|
+
id: gate
|
|
175
|
+
env:
|
|
176
|
+
EVENT: ${{ github.event_name }}
|
|
177
|
+
CONCLUSION: ${{ github.event.workflow_run.conclusion }}
|
|
178
|
+
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
|
|
179
|
+
run: |
|
|
180
|
+
set -euo pipefail
|
|
181
|
+
if [ "$EVENT" = "workflow_run" ] && [ "$CONCLUSION" != "success" ]; then
|
|
182
|
+
echo "cut=false" >> "$GITHUB_OUTPUT"
|
|
183
|
+
echo "CI concluded \`$CONCLUSION\` at $HEAD_SHA — nothing to cut." | tee -a "$GITHUB_STEP_SUMMARY"
|
|
184
|
+
else
|
|
185
|
+
echo "cut=true" >> "$GITHUB_OUTPUT"
|
|
186
|
+
fi
|
|
187
|
+
|
|
168
188
|
- name: Fetch the colab CLI
|
|
169
189
|
run: |
|
|
170
190
|
set -euo pipefail
|
|
@@ -219,7 +239,7 @@ jobs:
|
|
|
219
239
|
# right after this run promoted: that head has no CI yet — the dispatched run cuts it.
|
|
220
240
|
- name: Cut a candidate (colab release cut --auto)
|
|
221
241
|
id: cut
|
|
222
|
-
if: (github.event_name == 'workflow_run' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && steps.promote.outputs.promoted != 'true'
|
|
242
|
+
if: steps.gate.outputs.cut == 'true' && (github.event_name == 'workflow_run' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && steps.promote.outputs.promoted != 'true'
|
|
223
243
|
run: |
|
|
224
244
|
set -uo pipefail
|
|
225
245
|
OUT="$RUNNER_TEMP/cut.json"
|