@feigi/fleet-ctl 3.122.2 → 3.123.0
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/package.json +1 -1
- package/scripts/claim-ticket.sh +12 -3
- package/scripts/drop-merged-label.sh +17 -5
- package/scripts/release-ticket.sh +15 -4
package/package.json
CHANGED
package/scripts/claim-ticket.sh
CHANGED
|
@@ -264,16 +264,25 @@ tmpl_stamp=${tmpl_stamp%% *}
|
|
|
264
264
|
# ticket claimed: the rc-0 half of the same hole the pipeline form opened.
|
|
265
265
|
[ -n "$tmpl_stamp" ] || die "cksum $0 produced no checksum — refusing to claim without a runner template stamp"
|
|
266
266
|
|
|
267
|
+
# The string the tracker uses for the in-progress role, read from the Label
|
|
268
|
+
# map by label-map.mjs's `show`, the sibling beside this script, before the
|
|
269
|
+
# first label use, so every label write and `would:` line below types it. No
|
|
270
|
+
# map or an invalid one is `show`'s exit 1, its own message naming `ensure`
|
|
271
|
+
# on stderr; `show`'s stdout is the string alone, so stderr is left to reach
|
|
272
|
+
# the terminal rather than merged into it.
|
|
273
|
+
in_progress=$(node "$script_dir/label-map.mjs" show in-progress) \
|
|
274
|
+
|| die "could not read the in-progress label from the Label map — nothing claimed"
|
|
275
|
+
|
|
267
276
|
if [ "$apply" = false ]; then
|
|
268
277
|
echo "$NAME: DRY RUN — nothing created. Pass --apply to act." >&2
|
|
269
|
-
echo " would: gh issue edit $issue --add-label
|
|
278
|
+
echo " would: gh issue edit $issue --add-label $in_progress" >&2
|
|
270
279
|
printf ' would: git worktree add --no-track %s -b %s origin/main\n' "$wt" "$branch" >&2
|
|
271
280
|
printf ' would: (cd %s && %s)\n' "$wt" "$install" >&2
|
|
272
281
|
printf ' would: write %s and add it to .git/info/exclude — skipped if %s is\n' "$runner" "$runner" >&2
|
|
273
282
|
printf ' already present, a repo-local runner checked out with the worktree\n' >&2
|
|
274
283
|
else
|
|
275
|
-
echo "\$ gh issue edit $issue --add-label
|
|
276
|
-
gh issue edit "$issue" --add-label
|
|
284
|
+
echo "\$ gh issue edit $issue --add-label $in_progress" >&2
|
|
285
|
+
gh issue edit "$issue" --add-label "$in_progress" >/dev/null || die "could not label issue $issue"
|
|
277
286
|
|
|
278
287
|
# `--no-track`: without it, `-b … origin/main` leaves $branch tracking
|
|
279
288
|
# origin/main, so `@{u}` RESOLVES — to main. Every "did my push land?" check a
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
# Dry-run by default; --apply mutates the tracker. Exit 0 done (or dry run),
|
|
28
28
|
# 1 one or more removals failed — REPORT THIS, never swallow it: a merged
|
|
29
29
|
# ticket that keeps the label is a future invisible ticket, 2 could not even
|
|
30
|
-
# tell what this PR closes.
|
|
30
|
+
# tell what this PR closes, or which label to drop (no valid Label map).
|
|
31
31
|
set -eu
|
|
32
32
|
|
|
33
33
|
NAME=drop-merged-label
|
|
@@ -135,6 +135,16 @@ if [ -z "$issues" ]; then
|
|
|
135
135
|
exit 0
|
|
136
136
|
fi
|
|
137
137
|
|
|
138
|
+
# The string the tracker uses for the in-progress role, read from the Label
|
|
139
|
+
# map by label-map.mjs's `show`, the sibling beside this script, before the
|
|
140
|
+
# first label scan, so every scan, `would:` line and label drop below types
|
|
141
|
+
# it. No map or an invalid one is `show`'s exit 1, its own message naming
|
|
142
|
+
# `ensure` on stderr, and this script's exit 2: nothing scanned, nothing
|
|
143
|
+
# dropped. `show`'s stdout is the string alone, so stderr is left to reach the
|
|
144
|
+
# terminal rather than merged into it.
|
|
145
|
+
in_progress=$(node "$(dirname "$0")/label-map.mjs" show in-progress) \
|
|
146
|
+
|| die "could not read the in-progress label from the Label map — nothing dropped"
|
|
147
|
+
|
|
138
148
|
results=""
|
|
139
149
|
failed=""
|
|
140
150
|
for n in $issues; do
|
|
@@ -153,7 +163,9 @@ for n in $issues; do
|
|
|
153
163
|
# scan itself broke — so a scan that could not look would read here exactly
|
|
154
164
|
# like a measurement that looked and found the label already gone, and the
|
|
155
165
|
# loop below would skip the removal a merged ticket still needs.
|
|
156
|
-
|
|
166
|
+
# Fixed-string, whole-line: a mapped string may hold regex characters, and a
|
|
167
|
+
# `.` in it read as a pattern would match a label that is not the string.
|
|
168
|
+
if printf '%s\n' "$labels" | grep -qxF -- "$in_progress"; then gp_rc=0; else gp_rc=$?; fi
|
|
157
169
|
case $gp_rc in
|
|
158
170
|
0) had=true ;;
|
|
159
171
|
1) had=false ;;
|
|
@@ -171,13 +183,13 @@ for n in $issues; do
|
|
|
171
183
|
fi
|
|
172
184
|
|
|
173
185
|
if [ "$apply" = false ]; then
|
|
174
|
-
echo " would: gh issue edit $n --remove-label
|
|
186
|
+
echo " would: gh issue edit $n --remove-label $in_progress" >&2
|
|
175
187
|
results="${results}{\"issue\":$n,\"hadLabel\":true,\"removed\":false},"
|
|
176
188
|
continue
|
|
177
189
|
fi
|
|
178
190
|
|
|
179
|
-
echo "\$ gh issue edit $n --remove-label
|
|
180
|
-
if gh issue edit "$n" --remove-label
|
|
191
|
+
echo "\$ gh issue edit $n --remove-label $in_progress" >&2
|
|
192
|
+
if gh issue edit "$n" --remove-label "$in_progress" >/dev/null; then
|
|
181
193
|
echo " #$n: dropped in-progress" >&2
|
|
182
194
|
results="${results}{\"issue\":$n,\"hadLabel\":true,\"removed\":true},"
|
|
183
195
|
else
|
|
@@ -1290,6 +1290,15 @@ if [ -n "$blockers" ]; then
|
|
|
1290
1290
|
exit 1
|
|
1291
1291
|
fi
|
|
1292
1292
|
|
|
1293
|
+
# The string the tracker uses for the in-progress role, read from the Label
|
|
1294
|
+
# map by label-map.mjs's `show`, the sibling beside this script, before the
|
|
1295
|
+
# label is read, so the scan, the `would:` line and the label drop below all
|
|
1296
|
+
# type it. No map or an invalid one is `show`'s exit 1, its own message naming
|
|
1297
|
+
# `ensure` on stderr; `show`'s stdout is the string alone, so stderr is left
|
|
1298
|
+
# to reach the terminal rather than merged into it.
|
|
1299
|
+
in_progress=$(node "$(dirname "$0")/label-map.mjs" show in-progress) \
|
|
1300
|
+
|| die "could not read the in-progress label from the Label map — nothing released"
|
|
1301
|
+
|
|
1293
1302
|
# Read the label before touching anything, so a tracker that cannot answer stops
|
|
1294
1303
|
# the run before any delete rather than halfway through it.
|
|
1295
1304
|
#
|
|
@@ -1312,7 +1321,9 @@ fi
|
|
|
1312
1321
|
# gone, and the release below would leave the ticket invisible to
|
|
1313
1322
|
# candidates.mjs with no artefact left to explain it — the same failure
|
|
1314
1323
|
# mode the comment above this block already guards against on the `gh` side.
|
|
1315
|
-
|
|
1324
|
+
# Fixed-string, whole-line: a mapped string may hold regex characters, and a
|
|
1325
|
+
# `.` in it read as a pattern would match a label that is not the string.
|
|
1326
|
+
if printf '%s\n' "$labels" | grep -qxF -- "$in_progress"; then rt_gp_rc=0; else rt_gp_rc=$?; fi
|
|
1316
1327
|
case $rt_gp_rc in
|
|
1317
1328
|
0) has_label=true ;;
|
|
1318
1329
|
1) has_label=false ;;
|
|
@@ -1321,7 +1332,7 @@ esac
|
|
|
1321
1332
|
|
|
1322
1333
|
if [ "$apply" = false ]; then
|
|
1323
1334
|
echo "$NAME: DRY RUN — nothing removed. Pass --apply to act." >&2
|
|
1324
|
-
[ "$has_label" = true ] && echo " would: gh issue edit $issue --remove-label
|
|
1335
|
+
[ "$has_label" = true ] && echo " would: gh issue edit $issue --remove-label $in_progress" >&2
|
|
1325
1336
|
[ -n "$wt" ] && printf ' would: git worktree remove %s\n' "$wt" >&2
|
|
1326
1337
|
[ "$has_branch" = true ] && echo " would: git update-ref -d refs/heads/$branch <its current tip>" >&2
|
|
1327
1338
|
if [ "$closed_pr" = true ]; then
|
|
@@ -1510,8 +1521,8 @@ else
|
|
|
1510
1521
|
fi
|
|
1511
1522
|
|
|
1512
1523
|
if [ "$has_label" = true ]; then
|
|
1513
|
-
echo "\$ gh issue edit $issue --remove-label
|
|
1514
|
-
gh issue edit "$issue" --remove-label
|
|
1524
|
+
echo "\$ gh issue edit $issue --remove-label $in_progress" >&2
|
|
1525
|
+
gh issue edit "$issue" --remove-label "$in_progress" >/dev/null ||
|
|
1515
1526
|
halt "could not drop in-progress from issue $issue"
|
|
1516
1527
|
fi
|
|
1517
1528
|
# Housekeeping, and the final statement under `set -e`: unchecked, a prune
|