forgedock 1.63.0 → 1.64.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/bin/config-schema.mjs +3 -0
- package/bin/engine/outcome-codes.mjs +5 -0
- package/bin/engine-cli.mjs +88 -12
- package/bin/env/cli.mjs +18 -1
- package/bin/lean/basered.mjs +56 -11
- package/bin/lean/basered.test.mjs +58 -5
- package/bin/lean/batch-health.mjs +46 -4
- package/bin/lean/batch-health.test.mjs +55 -1
- package/bin/lean/batch.mjs +6 -1
- package/bin/lean/batch.test.mjs +71 -6
- package/bin/lean/ceiling.mjs +47 -3
- package/bin/lean/ceiling.test.mjs +32 -1
- package/bin/lean/conformance.e2e.test.mjs +32 -6
- package/bin/lean/conformance.mjs +57 -13
- package/bin/lean/conformance.test.mjs +93 -1
- package/bin/lean/execution.mjs +15 -6
- package/bin/lean/execution.test.mjs +44 -3
- package/bin/lean/issuewatch-reconcile.mjs +2 -0
- package/bin/lean/issuewatch-reconcile.test.mjs +25 -0
- package/bin/lean/issuewatch.mjs +3 -0
- package/bin/lean/lanecheck.test.mjs +13 -1
- package/bin/lean/lean.mjs +157 -28
- package/bin/lean/lean.test.mjs +289 -21
- package/bin/lean/live-execution.mjs +25 -0
- package/bin/lean/live-execution.test.mjs +35 -1
- package/bin/lean/merged-park.mjs +76 -0
- package/bin/lean/merged-park.test.mjs +64 -0
- package/bin/lean/mergetrain.mjs +357 -0
- package/bin/lean/mergetrain.test.mjs +348 -0
- package/bin/lean/orchestrate-envhold.test.mjs +62 -0
- package/bin/lean/orchestrate-stacking.test.mjs +23 -1
- package/bin/lean/orchestrate-train.test.mjs +130 -0
- package/bin/lean/orchestrate-transient-git.test.mjs +53 -0
- package/bin/lean/orchestrate.mjs +159 -13
- package/bin/lean/prompts.mjs +4 -3
- package/bin/lean/release-review.mjs +8 -1
- package/bin/lean/release-review.test.mjs +42 -2
- package/bin/lean/release-status.test.mjs +53 -1
- package/bin/lean/release.mjs +6 -3
- package/bin/lean/render.mjs +6 -1
- package/bin/lean/sandbox-provider.contract.test.mjs +6 -0
- package/bin/lean/sandbox-remote.mjs +12 -2
- package/bin/lean/sched.mjs +19 -2
- package/bin/lean/sched.test.mjs +33 -1
- package/bin/lean/schedd-health.mjs +2 -1
- package/bin/lean/schedd-health.test.mjs +7 -0
- package/bin/lean/schedd.mjs +55 -7
- package/bin/lean/schedd.test.mjs +42 -1
- package/bin/lean/stacking.mjs +45 -0
- package/bin/lean/stacking.test.mjs +25 -1
- package/bin/lean/statuscomment.mjs +14 -8
- package/bin/lean/statuscomment.test.mjs +18 -1
- package/bin/lean/validate-catalog.mjs +1 -1
- package/bin/lean/validate-catalog.test.mjs +3 -0
- package/bin/lean/worktree.mjs +8 -3
- package/bin/lean/worktree.test.mjs +18 -0
- package/bin/pool/agent.mjs +296 -31
- package/bin/pool/cli.mjs +120 -6
- package/bin/pool/disk.mjs +43 -0
- package/bin/pool/docker.mjs +10 -0
- package/bin/pool/health.mjs +95 -0
- package/bin/pool/router.mjs +274 -27
- package/bin/runner.mjs +3 -1
- package/bin/stats/chains.mjs +101 -0
- package/bin/stats/chains.test.mjs +53 -0
- package/bin/stats/efficiency.mjs +7 -6
- package/bin/stats/efficiency.test.mjs +48 -7
- package/bin/stats/index.mjs +11 -3
- package/bin/stats/stats.test.mjs +9 -0
- package/docs/CONFIG.md +8 -1
- package/docs/OUTCOME-CODES.md +4 -0
- package/package.json +1 -1
- package/pool/README.md +10 -0
- package/pool/image/Dockerfile +2 -1
- package/pool/image/entrypoint.sh +6 -6
- package/pool/image/mirror.sh +71 -0
- package/pool/install/install-agent-linux.sh +57 -5
- package/pool/install/install-agent-macos.sh +148 -0
- package/pool/install/install-agent.ps1 +11 -0
- package/pool/install/install-agent.sh +59 -7
- package/pool/install/uninstall-agent-linux.sh +75 -0
- package/pool/install/uninstall-agent-macos.sh +60 -0
- package/pool/install/uninstall-agent.ps1 +1 -0
- package/scripts/transition-label.sh +11 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
|
|
3
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
+
# macOS agent install (#5883): node and the agent code under /usr/local/computeshare, config and agent token in /usr/local/etc/computeshare,
|
|
5
|
+
# state in /usr/local/var/computeshare, LaunchDaemon io.forgedock.computeshare-agent. Always outbound: the agent dials the router (no inbound port).
|
|
6
|
+
# Needs a running docker runtime (Docker Desktop, colima, OrbStack): it is never installed here (a GUI app with licence and permission prompts).
|
|
7
|
+
# Usage: install-agent-macos.sh --router URL --token CODE [--name N] [--port P] [--cpus N] [--mem GB] [--bundle FILE] [--outbound] [--dry-run]
|
|
8
|
+
# Rerun: an existing agent token is kept (never re-enrolled); without --bundle the installed code is reused (no download).
|
|
9
|
+
# Uninstall: uninstall-agent-macos.sh.
|
|
10
|
+
set -euo pipefail
|
|
11
|
+
DRY=0
|
|
12
|
+
while [ $# -gt 0 ]; do
|
|
13
|
+
case "$1" in
|
|
14
|
+
--router) ROUTER_URL="${2:?}"; shift 2 ;;
|
|
15
|
+
--token) ENROLL_TOKEN="${2:?}"; shift 2 ;;
|
|
16
|
+
--name) AGENT_NAME="${2:?}"; shift 2 ;;
|
|
17
|
+
--port) AGENT_PORT="${2:?}"; shift 2 ;;
|
|
18
|
+
--cpus) ALLOW_CPUS="${2:?}"; shift 2 ;;
|
|
19
|
+
--mem) ALLOW_MEM_GB="${2:?}"; shift 2 ;;
|
|
20
|
+
--bundle) BUNDLE="${2:?}"; shift 2 ;;
|
|
21
|
+
--outbound) shift ;; # the only mode on macOS; accepted so the /install bootstrap passes the same flags on both systems
|
|
22
|
+
--dry-run) DRY=1; shift ;;
|
|
23
|
+
*) echo "unknown argument: $1" >&2; exit 2 ;;
|
|
24
|
+
esac
|
|
25
|
+
done
|
|
26
|
+
: "${ROUTER_URL:?--router or ROUTER_URL required}" "${ENROLL_TOKEN:?--token or ENROLL_TOKEN required}"
|
|
27
|
+
NODE_VERSION=22.12.0
|
|
28
|
+
ROOT=/usr/local/computeshare ETC=/usr/local/etc/computeshare STATE=/usr/local/var/computeshare
|
|
29
|
+
LABEL=io.forgedock.computeshare-agent PLIST="/Library/LaunchDaemons/io.forgedock.computeshare-agent.plist"
|
|
30
|
+
PORT="${AGENT_PORT:-7711}"
|
|
31
|
+
AGENT_NAME="${AGENT_NAME:-$(hostname -s 2>/dev/null || hostname)}"
|
|
32
|
+
AGENT_NAME="$(printf '%s' "$AGENT_NAME" | tr 'A-Z' 'a-z')"
|
|
33
|
+
# Same defaults as the Linux installer: logical CPUs minus 4 (min 2); half of physical RAM (min 4 GB).
|
|
34
|
+
CPUS="${ALLOW_CPUS:-0}"
|
|
35
|
+
if [ "$CPUS" -le 0 ]; then CPUS=$(( $(sysctl -n hw.ncpu 2>/dev/null || echo 6) - 4 )); [ "$CPUS" -ge 2 ] || CPUS=2; fi
|
|
36
|
+
MEM="${ALLOW_MEM_GB:-0}"
|
|
37
|
+
if [ "$MEM" -le 0 ]; then MEM=$(( $(sysctl -n hw.memsize 2>/dev/null || echo 8589934592) / 1073741824 / 2 )); [ "$MEM" -ge 4 ] || MEM=4; fi
|
|
38
|
+
log() { echo "[computeshare] $*"; }
|
|
39
|
+
|
|
40
|
+
# The docker endpoint of the console user (Docker Desktop / colima keep their socket in that user's home); root's launchd job gets it as DOCKER_HOST.
|
|
41
|
+
DOCKER_BIN="$(command -v docker || true)"
|
|
42
|
+
for d in /usr/local/bin/docker /opt/homebrew/bin/docker /Applications/Docker.app/Contents/Resources/bin/docker; do [ -n "$DOCKER_BIN" ] || { [ -x "$d" ] && DOCKER_BIN="$d"; }; done
|
|
43
|
+
|
|
44
|
+
if [ "$DRY" = 1 ]; then
|
|
45
|
+
echo "router=$ROUTER_URL name=$AGENT_NAME url= port=$PORT cpus=$CPUS mem_gb=$MEM bundle=${BUNDLE:-<download>} root=$ROOT docker=${DOCKER_BIN:-<missing>} token=<redacted>"
|
|
46
|
+
exit 0
|
|
47
|
+
fi
|
|
48
|
+
[ "$(uname -s)" = Darwin ] || { echo "install-agent-macos.sh is for macOS; on Linux use install-agent-linux.sh" >&2; exit 1; }
|
|
49
|
+
[ "$(id -u)" = 0 ] || { echo "run as root (sudo)" >&2; exit 1; }
|
|
50
|
+
OWNER="${SUDO_USER:-$(stat -f %Su /dev/console 2>/dev/null || id -un)}"
|
|
51
|
+
DOCKER_HOST_URL="${DOCKER_HOST:-}"
|
|
52
|
+
if [ -z "$DOCKER_HOST_URL" ] && [ -n "$DOCKER_BIN" ]; then
|
|
53
|
+
DOCKER_HOST_URL="$(sudo -u "$OWNER" "$DOCKER_BIN" context inspect --format '{{.Endpoints.docker.Host}}' 2>/dev/null || true)"
|
|
54
|
+
fi
|
|
55
|
+
if [ -z "$DOCKER_BIN" ] || ! DOCKER_HOST="$DOCKER_HOST_URL" "$DOCKER_BIN" info >/dev/null 2>&1; then
|
|
56
|
+
echo "no running docker runtime found. Install and start Docker Desktop (https://www.docker.com/products/docker-desktop/) or colima (brew install colima docker && colima start), then rerun." >&2
|
|
57
|
+
exit 1
|
|
58
|
+
fi
|
|
59
|
+
export DOCKER_HOST="$DOCKER_HOST_URL"
|
|
60
|
+
|
|
61
|
+
install -d -m 0755 "$ROOT"
|
|
62
|
+
install -d -m 0700 "$ETC" "$STATE"
|
|
63
|
+
MARKER="$ETC/installed-by"
|
|
64
|
+
mark() { grep -qx "$1" "$MARKER" 2>/dev/null || echo "$1" >> "$MARKER"; }
|
|
65
|
+
|
|
66
|
+
if [ ! -x "$ROOT/node/bin/node" ] || [ "$("$ROOT/node/bin/node" --version)" != "v${NODE_VERSION}" ]; then
|
|
67
|
+
log "node ${NODE_VERSION}"
|
|
68
|
+
case "$(uname -m)" in arm64) NODE_ARCH=arm64 ;; *) NODE_ARCH=x64 ;; esac
|
|
69
|
+
rm -rf "$ROOT/node" "$ROOT/node-v${NODE_VERSION}-darwin-${NODE_ARCH}"
|
|
70
|
+
curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-darwin-${NODE_ARCH}.tar.gz" | tar -xz -C "$ROOT"
|
|
71
|
+
mv "$ROOT/node-v${NODE_VERSION}-darwin-${NODE_ARCH}" "$ROOT/node"
|
|
72
|
+
mark node
|
|
73
|
+
fi
|
|
74
|
+
NODE="$ROOT/node/bin/node"
|
|
75
|
+
|
|
76
|
+
TMP="$(mktemp -d /tmp/computeshare-install.XXXXXX)"
|
|
77
|
+
trap 'rm -rf "$TMP"' EXIT
|
|
78
|
+
if [ -z "${BUNDLE:-}" ]; then
|
|
79
|
+
BUNDLE="$TMP/bundle.tar.gz"
|
|
80
|
+
if [ -s "$ETC/agent.token" ] && [ -f "$ROOT/package.json" ]; then
|
|
81
|
+
log "already enrolled: reinstalling from $ROOT (no bundle download)"
|
|
82
|
+
tar --exclude ./node -czf "$BUNDLE" -C "$ROOT" .
|
|
83
|
+
else
|
|
84
|
+
curl -fsS "${ROUTER_URL}/bootstrap/bundle.tar.gz?token=${ENROLL_TOKEN}" -o "$BUNDLE"
|
|
85
|
+
fi
|
|
86
|
+
fi
|
|
87
|
+
log "agent code"
|
|
88
|
+
mkdir -p "$TMP/code"
|
|
89
|
+
tar -xzf "$BUNDLE" -C "$TMP/code"
|
|
90
|
+
# Replace everything under $ROOT but node, so a rerun neither keeps stale files nor downloads node again.
|
|
91
|
+
find "$ROOT" -mindepth 1 -maxdepth 1 ! -name node -exec rm -rf {} +
|
|
92
|
+
( cd "$TMP/code" && tar -cf - . ) | ( cd "$ROOT" && tar -xf - )
|
|
93
|
+
|
|
94
|
+
if [ ! -s "$ETC/agent.token" ]; then
|
|
95
|
+
log "enrolling ${AGENT_NAME} (outbound) with ${ROUTER_URL}"
|
|
96
|
+
body="$("$NODE" -e 'process.stdout.write(JSON.stringify({ token: process.argv[1], name: process.argv[2] }))' "$ENROLL_TOKEN" "$AGENT_NAME")"
|
|
97
|
+
resp="$(curl -fsS -X POST "${ROUTER_URL}/enroll" -H 'content-type: application/json' -d "$body")"
|
|
98
|
+
tok="$(printf '%s' "$resp" | "$NODE" -e 'let s="";process.stdin.on("data",(d)=>s+=d).on("end",()=>{try{process.stdout.write(String(JSON.parse(s).agent_token??""))}catch{}})')"
|
|
99
|
+
[ -n "$tok" ] || { echo "enrollment failed: $resp" >&2; exit 1; }
|
|
100
|
+
( umask 077; printf '%s\n' "$tok" > "$ETC/agent.token" )
|
|
101
|
+
fi
|
|
102
|
+
|
|
103
|
+
# Lanes reach the agent through host.docker.internal, which Docker Desktop / colima forward to this Mac's loopback.
|
|
104
|
+
"$NODE" -e '
|
|
105
|
+
const [name, router, port, cpus, mem, etc, root, state] = process.argv.slice(1);
|
|
106
|
+
require("fs").writeFileSync(`${etc}/agent.json`, JSON.stringify({
|
|
107
|
+
name, listen: { host: "127.0.0.1", port: Number(port) }, token_file: `${etc}/agent.token`, router_url: router, code_root: root, state_dir: state,
|
|
108
|
+
allow_cpus: Number(cpus), allow_mem_gb: Number(mem), lease_ttl_s: 600, max_lifetime_s: 21600, keep_exited_s: 7200, reap_interval_s: 30, outbound: true,
|
|
109
|
+
}, null, 2) + "\n", { mode: 0o600 });' "$AGENT_NAME" "$ROUTER_URL" "$PORT" "$CPUS" "$MEM" "$ETC" "$ROOT" "$STATE"
|
|
110
|
+
|
|
111
|
+
log "building lane image (first run takes several minutes)"
|
|
112
|
+
FD_VERSION="$("$NODE" -p 'require(process.argv[1]).version' "$ROOT/package.json")"
|
|
113
|
+
"$DOCKER_BIN" build -q -t "forgedock-lane:${FD_VERSION}" --build-arg "FORGEDOCK_VERSION=${FD_VERSION}" "$ROOT/pool/image" >/dev/null
|
|
114
|
+
|
|
115
|
+
cat > "$PLIST" <<EOF
|
|
116
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
117
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
118
|
+
<plist version="1.0">
|
|
119
|
+
<dict>
|
|
120
|
+
<key>Label</key><string>${LABEL}</string>
|
|
121
|
+
<key>ProgramArguments</key>
|
|
122
|
+
<array><string>${NODE}</string><string>${ROOT}/bin/pool/cli.mjs</string><string>agent</string><string>--config</string><string>${ETC}/agent.json</string></array>
|
|
123
|
+
<key>EnvironmentVariables</key>
|
|
124
|
+
<dict>
|
|
125
|
+
<key>PATH</key><string>$(dirname "$DOCKER_BIN"):/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
|
|
126
|
+
<key>DOCKER_HOST</key><string>${DOCKER_HOST_URL}</string>
|
|
127
|
+
</dict>
|
|
128
|
+
<key>RunAtLoad</key><true/>
|
|
129
|
+
<key>KeepAlive</key><true/>
|
|
130
|
+
<key>ThrottleInterval</key><integer>5</integer>
|
|
131
|
+
<key>StandardOutPath</key><string>${STATE}/agent.log</string>
|
|
132
|
+
<key>StandardErrorPath</key><string>${STATE}/agent.log</string>
|
|
133
|
+
</dict>
|
|
134
|
+
</plist>
|
|
135
|
+
EOF
|
|
136
|
+
chmod 0644 "$PLIST"
|
|
137
|
+
launchctl bootout "system/${LABEL}" >/dev/null 2>&1 || true
|
|
138
|
+
launchctl bootstrap system "$PLIST"
|
|
139
|
+
|
|
140
|
+
for i in $(seq 1 20); do
|
|
141
|
+
if curl -fsS "http://127.0.0.1:${PORT}/health" >/dev/null 2>&1; then
|
|
142
|
+
log "agent healthy: $(curl -fsS "http://127.0.0.1:${PORT}/health")"
|
|
143
|
+
exit 0
|
|
144
|
+
fi
|
|
145
|
+
sleep 1
|
|
146
|
+
done
|
|
147
|
+
echo "agent did not become healthy; see: ${STATE}/agent.log" >&2
|
|
148
|
+
exit 1
|
|
@@ -131,6 +131,14 @@ foreach ($l in $lines) {
|
|
|
131
131
|
}
|
|
132
132
|
if ($inWsl2) { foreach ($k in $want.Keys) { if (-not $seen[$k]) { $out.Add("$k=$($want[$k])"); $seen[$k] = $true } } }
|
|
133
133
|
if (-not ($out | Where-Object { $_ -match '^\s*\[wsl2\]\s*$' })) { $out.Add('[wsl2]'); foreach ($k in $want.Keys) { $out.Add("$k=$($want[$k])") } }
|
|
134
|
+
# #5884: sparse VHD (freed blocks shrink the vhdx, so a lane burst cannot pin the Windows drive full). [experimental] is its own section.
|
|
135
|
+
$expIdx = -1; for ($i = 0; $i -lt $out.Count; $i++) { if ($out[$i] -match '^\s*\[experimental\]\s*$') { $expIdx = $i; break } }
|
|
136
|
+
if ($expIdx -lt 0) { $out.Add('[experimental]'); $out.Add('sparseVhd=true') }
|
|
137
|
+
else {
|
|
138
|
+
$j = $expIdx + 1; $found = $false
|
|
139
|
+
while ($j -lt $out.Count -and $out[$j] -notmatch '^\s*\[') { if ($out[$j] -match '^\s*sparseVhd\s*=') { $out[$j] = 'sparseVhd=true'; $found = $true }; $j++ }
|
|
140
|
+
if (-not $found) { $out.Insert($expIdx + 1, 'sparseVhd=true') }
|
|
141
|
+
}
|
|
134
142
|
$changed = (($lines -join "`n") -ne ($out -join "`n"))
|
|
135
143
|
if ($changed) {
|
|
136
144
|
if (Test-Path $wslConfig) { Copy-Item $wslConfig "$wslConfig.computeshare-backup" -Force }
|
|
@@ -165,6 +173,9 @@ if ($distros -notcontains $Distro) {
|
|
|
165
173
|
Remove-Item $tar -Force
|
|
166
174
|
}
|
|
167
175
|
|
|
176
|
+
# #5884: convert the already imported vhdx to sparse (best effort: older WSL builds lack --manage --set-sparse).
|
|
177
|
+
[void](Invoke-Wsl @('--manage', $Distro, '--set-sparse', 'true') 300 -Optional)
|
|
178
|
+
|
|
168
179
|
# systemd for docker + the agent; no Windows PATH or Windows binaries inside the lane distro.
|
|
169
180
|
$wslConf = "[boot]\nsystemd=true\n\n[network]\nhostname=$AgentName-cs\n\n[interop]\nappendWindowsPath=false\n"
|
|
170
181
|
$before = (Invoke-Wsl @('-d', $Distro, '-u', 'root', '--', 'cat', '/etc/wsl.conf') 120).out
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
# SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
|
|
3
3
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
4
|
# Linux side of the agent install. Runs as root inside the dedicated `computeshare` WSL distro (or any systemd Linux host).
|
|
5
|
-
# Required env: ROUTER_URL ENROLL_TOKEN AGENT_NAME AGENT_URL ALLOW_CPUS ALLOW_MEM_GB BUNDLE
|
|
5
|
+
# Required env: ROUTER_URL ENROLL_TOKEN AGENT_NAME AGENT_URL (empty with OUTBOUND=1: the agent polls the router, #5882) ALLOW_CPUS ALLOW_MEM_GB BUNDLE
|
|
6
6
|
set -euo pipefail
|
|
7
|
-
: "${ROUTER_URL:?}" "${ENROLL_TOKEN:?}" "${AGENT_NAME:?}" "${AGENT_URL
|
|
7
|
+
: "${ROUTER_URL:?}" "${ENROLL_TOKEN:?}" "${AGENT_NAME:?}" "${AGENT_URL?}" "${ALLOW_CPUS:?}" "${ALLOW_MEM_GB:?}" "${BUNDLE:?}"
|
|
8
8
|
# Never resolve tools through the Windows PATH that WSL appends (e.g. Docker Desktop's docker CLI).
|
|
9
9
|
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
10
10
|
NODE_VERSION=22.12.0
|
|
@@ -14,6 +14,12 @@ log() { echo "[computeshare] $*"; }
|
|
|
14
14
|
[ "$(id -u)" = 0 ] || { echo "run as root" >&2; exit 1; }
|
|
15
15
|
pidof systemd >/dev/null || [ "$(ps -p 1 -o comm=)" = systemd ] || { echo "systemd is not PID 1; enable it in /etc/wsl.conf and restart the distro" >&2; exit 1; }
|
|
16
16
|
|
|
17
|
+
# #5883: what this installer added to the host (one per line: docker, node, sysctl, fstrim.timer). uninstall-agent-linux.sh removes
|
|
18
|
+
# only what the marker lists; lines from earlier runs are kept, so a rerun never forgets a component it found already installed.
|
|
19
|
+
install -d -m 0700 /etc/computeshare /var/lib/computeshare
|
|
20
|
+
MARKER=/etc/computeshare/installed-by
|
|
21
|
+
mark() { grep -qx "$1" "$MARKER" 2>/dev/null || echo "$1" >> "$MARKER"; }
|
|
22
|
+
|
|
17
23
|
log "base packages"
|
|
18
24
|
export DEBIAN_FRONTEND=noninteractive
|
|
19
25
|
apt-get update -qq
|
|
@@ -28,14 +34,58 @@ if [ ! -x /usr/bin/dockerd ]; then
|
|
|
28
34
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/${DOCKER_DISTRO} ${VERSION_CODENAME} stable" > /etc/apt/sources.list.d/docker.list
|
|
29
35
|
apt-get update -qq
|
|
30
36
|
apt-get install -y -qq docker-ce docker-ce-cli containerd.io >/dev/null
|
|
37
|
+
mark docker
|
|
31
38
|
fi
|
|
32
39
|
# WSL mirrored networking usually has no IPv6 route; dockerd would still dial registries over IPv6 and fail.
|
|
33
40
|
if grep -qi microsoft /proc/sys/kernel/osrelease && [ -z "$(ip -6 route show default 2>/dev/null)" ]; then
|
|
34
41
|
printf 'net.ipv6.conf.all.disable_ipv6=1\nnet.ipv6.conf.default.disable_ipv6=1\n' > /etc/sysctl.d/90-computeshare-noipv6.conf
|
|
35
42
|
sysctl -q -p /etc/sysctl.d/90-computeshare-noipv6.conf
|
|
43
|
+
mark sysctl
|
|
36
44
|
systemctl restart docker 2>/dev/null || true
|
|
37
45
|
fi
|
|
38
46
|
systemctl enable --now docker >/dev/null
|
|
47
|
+
# #5923: WSL mirrored networking leaves the guest a narrow source-port range that docker's MASQUERADE ignores; pin it (idempotent, re-run when docker restarts).
|
|
48
|
+
if grep -qi microsoft /proc/sys/kernel/osrelease; then
|
|
49
|
+
cat > /usr/local/sbin/cs-nat-portrange <<'CS_NAT_SCRIPT'
|
|
50
|
+
#!/bin/sh
|
|
51
|
+
# cs-nat-portrange: pin docker NAT source ports to the guest ip_local_port_range (WSL mirrored networking)
|
|
52
|
+
set -eu
|
|
53
|
+
set -- $(sysctl -n net.ipv4.ip_local_port_range) || exit 0
|
|
54
|
+
lo=$1; hi=$2
|
|
55
|
+
[ "$lo" -gt 32768 ] || [ "$hi" -lt 60999 ] || exit 0
|
|
56
|
+
docker network ls --filter driver=bridge -q | while read -r id; do
|
|
57
|
+
info=$(docker network inspect -f '{{.Name}}|{{index .Options "com.docker.network.bridge.name"}}|{{range .IPAM.Config}}{{.Subnet}} {{end}}' "$id") || continue
|
|
58
|
+
name=${info%%|*}; rest=${info#*|}; bridge=${rest%%|*}; subnets=${rest#*|}
|
|
59
|
+
if [ -z "$bridge" ]; then if [ "$name" = bridge ]; then bridge=docker0; else bridge="br-$(echo "$id" | cut -c1-12)"; fi; fi
|
|
60
|
+
for subnet in $subnets; do
|
|
61
|
+
case "$subnet" in *:*) continue ;; esac
|
|
62
|
+
for proto in tcp udp; do
|
|
63
|
+
iptables -t nat -C POSTROUTING -s "$subnet" ! -o "$bridge" -p "$proto" -j MASQUERADE --to-ports "$lo-$hi" 2>/dev/null ||
|
|
64
|
+
iptables -t nat -I POSTROUTING 1 -s "$subnet" ! -o "$bridge" -p "$proto" -j MASQUERADE --to-ports "$lo-$hi"
|
|
65
|
+
done
|
|
66
|
+
done
|
|
67
|
+
done
|
|
68
|
+
CS_NAT_SCRIPT
|
|
69
|
+
chmod 0755 /usr/local/sbin/cs-nat-portrange
|
|
70
|
+
cat > /etc/systemd/system/cs-nat-portrange.service <<'CS_NAT_UNIT'
|
|
71
|
+
[Unit]
|
|
72
|
+
Description=Pin docker NAT source ports to the WSL guest port range
|
|
73
|
+
After=docker.service
|
|
74
|
+
PartOf=docker.service
|
|
75
|
+
|
|
76
|
+
[Service]
|
|
77
|
+
Type=oneshot
|
|
78
|
+
RemainAfterExit=yes
|
|
79
|
+
ExecStart=/usr/local/sbin/cs-nat-portrange
|
|
80
|
+
|
|
81
|
+
[Install]
|
|
82
|
+
WantedBy=docker.service
|
|
83
|
+
CS_NAT_UNIT
|
|
84
|
+
systemctl daemon-reload
|
|
85
|
+
systemctl enable cs-nat-portrange.service >/dev/null 2>&1 || true
|
|
86
|
+
systemctl restart cs-nat-portrange.service || true
|
|
87
|
+
mark nat-pin
|
|
88
|
+
fi
|
|
39
89
|
|
|
40
90
|
if [ ! -x /opt/node/bin/node ] || [ "$(/opt/node/bin/node --version)" != "v${NODE_VERSION}" ]; then
|
|
41
91
|
log "node ${NODE_VERSION}"
|
|
@@ -43,6 +93,7 @@ if [ ! -x /opt/node/bin/node ] || [ "$(/opt/node/bin/node --version)" != "v${NOD
|
|
|
43
93
|
case "$(uname -m)" in aarch64|arm64) NODE_ARCH=arm64 ;; *) NODE_ARCH=x64 ;; esac
|
|
44
94
|
curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.xz" | tar -xJ -C /opt
|
|
45
95
|
mv "/opt/node-v${NODE_VERSION}-linux-${NODE_ARCH}" /opt/node
|
|
96
|
+
mark node
|
|
46
97
|
fi
|
|
47
98
|
|
|
48
99
|
log "agent code"
|
|
@@ -51,21 +102,22 @@ tar -xzf "$BUNDLE" -C /opt/computeshare.new
|
|
|
51
102
|
rm -rf /opt/computeshare && mv /opt/computeshare.new /opt/computeshare
|
|
52
103
|
|
|
53
104
|
install -d -m 0700 /etc/computeshare /var/lib/computeshare
|
|
54
|
-
if [ ! -s /etc/computeshare/agent.token ]; then
|
|
105
|
+
if [ ! -s /etc/computeshare/agent.token ]; then # a rerun keeps its agent token: never re-enrolled (#5883)
|
|
55
106
|
log "enrolling ${AGENT_NAME} (${AGENT_URL}) with ${ROUTER_URL}"
|
|
56
107
|
resp=$(curl -fsS -X POST "${ROUTER_URL}/enroll" -H 'content-type: application/json' \
|
|
57
|
-
-d "$(jq -n --arg t "$ENROLL_TOKEN" --arg n "$AGENT_NAME" --arg u "$AGENT_URL" '{token:$t,name:$n
|
|
108
|
+
-d "$(jq -n --arg t "$ENROLL_TOKEN" --arg n "$AGENT_NAME" --arg u "$AGENT_URL" '{token:$t,name:$n} + (if $u == "" then {} else {url:$u} end)')")
|
|
58
109
|
umask 077
|
|
59
110
|
echo "$resp" | jq -r .agent_token > /etc/computeshare/agent.token
|
|
60
111
|
[ -s /etc/computeshare/agent.token ] && [ "$(cat /etc/computeshare/agent.token)" != null ] || { echo "enrollment failed: $resp" >&2; rm -f /etc/computeshare/agent.token; exit 1; }
|
|
61
112
|
fi
|
|
62
113
|
|
|
63
|
-
|
|
64
|
-
|
|
114
|
+
OUTBOUND="${OUTBOUND:-0}"
|
|
115
|
+
jq -n --arg name "$AGENT_NAME" --arg router "$ROUTER_URL" --arg outbound "$OUTBOUND" --arg lhost "${AGENT_LISTEN_HOST:-172.17.0.1}" --argjson port "$PORT" --argjson cpus "$ALLOW_CPUS" --argjson mem "$ALLOW_MEM_GB" '{
|
|
116
|
+
name: $name, listen: {host: (if $outbound == "1" then $lhost else "0.0.0.0" end), port: $port}, token_file: "/etc/computeshare/agent.token",
|
|
65
117
|
router_url: $router, code_root: "/opt/computeshare",
|
|
66
118
|
state_dir: "/var/lib/computeshare",
|
|
67
119
|
allow_cpus: $cpus, allow_mem_gb: $mem, lease_ttl_s: 600, max_lifetime_s: 21600, keep_exited_s: 7200, reap_interval_s: 30
|
|
68
|
-
}' > /etc/computeshare/agent.json
|
|
120
|
+
} + (if $outbound == "1" then {outbound: true} else {} end)' > /etc/computeshare/agent.json
|
|
69
121
|
chmod 0600 /etc/computeshare/agent.json
|
|
70
122
|
|
|
71
123
|
log "building lane image (first run takes several minutes)"
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
|
|
3
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
+
# Removes the computeshare agent from a native Linux (systemd) host (#5883): the computeshare-agent unit, this agent's lane containers,
|
|
5
|
+
# volumes and forgedock-lane images, /opt/computeshare, /etc/computeshare, /var/lib/computeshare and the sysctl drop-in. Docker, /opt/node
|
|
6
|
+
# and fstrim.timer are removed only when /etc/computeshare/installed-by says the installer added them. Never `docker system prune`:
|
|
7
|
+
# containers and volumes of other workloads on the same daemon are left alone. No user is created by the installer, so none is removed.
|
|
8
|
+
# Usage: uninstall-agent-linux.sh [--dry-run] (idempotent: on a clean host it removes nothing and exits 0)
|
|
9
|
+
# CS_PREFIX (tests only) roots every path under a scratch dir and lifts the root check.
|
|
10
|
+
set -euo pipefail
|
|
11
|
+
DRY=0
|
|
12
|
+
while [ $# -gt 0 ]; do
|
|
13
|
+
case "$1" in
|
|
14
|
+
--dry-run) DRY=1; shift ;;
|
|
15
|
+
*) echo "unknown argument: $1" >&2; exit 2 ;;
|
|
16
|
+
esac
|
|
17
|
+
done
|
|
18
|
+
# Appended, not prepended, so a caller's PATH wins; never resolve tools through a Windows PATH first.
|
|
19
|
+
export PATH="${PATH:+$PATH:}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
|
20
|
+
P="${CS_PREFIX:-}"
|
|
21
|
+
CODE="$P/opt/computeshare" ETC="$P/etc/computeshare" STATE="$P/var/lib/computeshare" NODE_DIR="$P/opt/node"
|
|
22
|
+
UNIT="$P/etc/systemd/system/computeshare-agent.service" SYSCTL="$P/etc/sysctl.d/90-computeshare-noipv6.conf"
|
|
23
|
+
log() { echo "[computeshare] $*"; }
|
|
24
|
+
run() { if [ "$DRY" = 1 ]; then echo "would run: $*"; else "$@" || log "note: '$*' failed (continuing)"; fi; }
|
|
25
|
+
del() { for f in "$@"; do if [ -e "$f" ] || [ -L "$f" ]; then if [ "$DRY" = 1 ]; then echo "would remove: $f"; else rm -rf "$f"; log "removed $f"; fi; fi; done; }
|
|
26
|
+
[ -n "$P" ] || [ "$DRY" = 1 ] || [ "$(id -u)" = 0 ] || { echo "run as root" >&2; exit 1; }
|
|
27
|
+
|
|
28
|
+
MARKS=""; [ -f "$ETC/installed-by" ] && MARKS="$(cat "$ETC/installed-by")"
|
|
29
|
+
marked() { printf '%s\n' "$MARKS" | grep -qx "$1"; }
|
|
30
|
+
# The agent id the agent labels its containers and volumes with (agent_id, else name; normalised as in bin/pool/agent.mjs).
|
|
31
|
+
AGENT_ID=""
|
|
32
|
+
if [ -f "$ETC/agent.json" ]; then
|
|
33
|
+
AGENT_ID="$(sed -n 's/^[[:space:]]*"agent_id":[[:space:]]*"\([^"]*\)".*/\1/p' "$ETC/agent.json" | head -1)"
|
|
34
|
+
[ -n "$AGENT_ID" ] || AGENT_ID="$(sed -n 's/^[[:space:]]*"name":[[:space:]]*"\([^"]*\)".*/\1/p' "$ETC/agent.json" | head -1)"
|
|
35
|
+
AGENT_ID="$(printf '%s' "$AGENT_ID" | tr 'A-Z' 'a-z' | sed 's/[^a-z0-9_.-]/-/g' | cut -c1-60)"
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# 1. The service first, so the agent cannot start new lanes while they are removed.
|
|
39
|
+
if command -v systemctl >/dev/null 2>&1; then
|
|
40
|
+
if [ -e "$UNIT" ] || systemctl list-unit-files computeshare-agent.service 2>/dev/null | grep -q computeshare-agent; then
|
|
41
|
+
run systemctl disable --now computeshare-agent.service
|
|
42
|
+
fi
|
|
43
|
+
fi
|
|
44
|
+
del "$UNIT"
|
|
45
|
+
command -v systemctl >/dev/null 2>&1 && run systemctl daemon-reload
|
|
46
|
+
|
|
47
|
+
# 2. Docker objects carrying this agent's label (#5881), plus the lane images. Nothing unlabelled, nothing of another agent.
|
|
48
|
+
if command -v docker >/dev/null 2>&1 && docker info >/dev/null 2>&1; then
|
|
49
|
+
if [ -n "$AGENT_ID" ]; then
|
|
50
|
+
for c in $(docker ps -a --filter "label=computeshare.agent=${AGENT_ID}" --format '{{.Names}}'); do run docker rm -f -v "$c"; done
|
|
51
|
+
for v in $(docker volume ls -q --filter "label=computeshare.agent=${AGENT_ID}"); do run docker volume rm -f "$v"; done
|
|
52
|
+
else
|
|
53
|
+
log "no agent.json: lane containers and volumes are left alone (cannot tell this agent's from another's)"
|
|
54
|
+
fi
|
|
55
|
+
for i in $(docker image ls --format '{{.Repository}}:{{.Tag}}' forgedock-lane); do run docker image rm -f "$i"; done
|
|
56
|
+
else
|
|
57
|
+
log "docker not reachable: no containers, volumes or images to remove"
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
# 3. Optional components, only when this installer added them.
|
|
61
|
+
if marked fstrim.timer && command -v systemctl >/dev/null 2>&1; then run systemctl disable --now fstrim.timer; fi
|
|
62
|
+
if [ -e "$SYSCTL" ]; then
|
|
63
|
+
del "$SYSCTL"
|
|
64
|
+
command -v sysctl >/dev/null 2>&1 && [ -z "$P" ] && run sysctl -q -w net.ipv6.conf.all.disable_ipv6=0 net.ipv6.conf.default.disable_ipv6=0
|
|
65
|
+
fi
|
|
66
|
+
if marked node; then del "$NODE_DIR"; fi
|
|
67
|
+
if marked docker; then
|
|
68
|
+
if command -v systemctl >/dev/null 2>&1; then run systemctl disable --now docker.service docker.socket containerd.service; fi
|
|
69
|
+
command -v apt-get >/dev/null 2>&1 && run apt-get purge -y -qq docker-ce docker-ce-cli containerd.io
|
|
70
|
+
del "$P/etc/apt/sources.list.d/docker.list" "$P/etc/apt/keyrings/docker.asc"
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
# 4. Code, config (agent token) and state.
|
|
74
|
+
del "$CODE" "$P/opt/computeshare.new" "$ETC" "$STATE"
|
|
75
|
+
if [ "$DRY" = 1 ]; then log "dry run: nothing removed"; else log "agent removed. Remove it from the router with: forgedock pool remove ${AGENT_ID:-<agent>}"; fi
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
|
|
3
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
+
# Removes the computeshare agent from macOS (#5883): the io.forgedock.computeshare-agent LaunchDaemon, this agent's lane containers, volumes
|
|
5
|
+
# and forgedock-lane images, /usr/local/computeshare (code and node), /usr/local/etc/computeshare and /usr/local/var/computeshare.
|
|
6
|
+
# The docker runtime (Docker Desktop / colima) was never installed by us and is left alone; never `docker system prune`.
|
|
7
|
+
# Usage: uninstall-agent-macos.sh [--dry-run] (idempotent: on a clean host it removes nothing and exits 0)
|
|
8
|
+
# CS_PREFIX (tests only) roots every path under a scratch dir and lifts the root check.
|
|
9
|
+
set -euo pipefail
|
|
10
|
+
DRY=0
|
|
11
|
+
while [ $# -gt 0 ]; do
|
|
12
|
+
case "$1" in
|
|
13
|
+
--dry-run) DRY=1; shift ;;
|
|
14
|
+
*) echo "unknown argument: $1" >&2; exit 2 ;;
|
|
15
|
+
esac
|
|
16
|
+
done
|
|
17
|
+
export PATH="${PATH:+$PATH:}/usr/local/bin:/opt/homebrew/bin:/Applications/Docker.app/Contents/Resources/bin:/usr/bin:/bin:/usr/sbin:/sbin"
|
|
18
|
+
P="${CS_PREFIX:-}"
|
|
19
|
+
LABEL=io.forgedock.computeshare-agent
|
|
20
|
+
ROOT="$P/usr/local/computeshare" ETC="$P/usr/local/etc/computeshare" STATE="$P/usr/local/var/computeshare"
|
|
21
|
+
PLIST="$P/Library/LaunchDaemons/${LABEL}.plist"
|
|
22
|
+
log() { echo "[computeshare] $*"; }
|
|
23
|
+
run() { if [ "$DRY" = 1 ]; then echo "would run: $*"; else "$@" || log "note: '$*' failed (continuing)"; fi; }
|
|
24
|
+
del() { for f in "$@"; do if [ -e "$f" ] || [ -L "$f" ]; then if [ "$DRY" = 1 ]; then echo "would remove: $f"; else rm -rf "$f"; log "removed $f"; fi; fi; done; }
|
|
25
|
+
[ -n "$P" ] || [ "$DRY" = 1 ] || [ "$(id -u)" = 0 ] || { echo "run as root (sudo)" >&2; exit 1; }
|
|
26
|
+
|
|
27
|
+
AGENT_ID=""
|
|
28
|
+
if [ -f "$ETC/agent.json" ]; then
|
|
29
|
+
AGENT_ID="$(sed -n 's/^[[:space:]]*"agent_id":[[:space:]]*"\([^"]*\)".*/\1/p' "$ETC/agent.json" | head -1)"
|
|
30
|
+
[ -n "$AGENT_ID" ] || AGENT_ID="$(sed -n 's/^[[:space:]]*"name":[[:space:]]*"\([^"]*\)".*/\1/p' "$ETC/agent.json" | head -1)"
|
|
31
|
+
AGENT_ID="$(printf '%s' "$AGENT_ID" | tr 'A-Z' 'a-z' | sed 's/[^a-z0-9_.-]/-/g' | cut -c1-60)"
|
|
32
|
+
fi
|
|
33
|
+
# The launchd job's DOCKER_HOST (the console user's Docker Desktop / colima socket), so docker reaches the daemon the agent used.
|
|
34
|
+
if [ -z "${DOCKER_HOST:-}" ] && [ -f "$PLIST" ]; then
|
|
35
|
+
dh="$(sed -n '/<key>DOCKER_HOST<\/key>/s/.*<string>\(.*\)<\/string>.*/\1/p' "$PLIST" | head -1)"
|
|
36
|
+
[ -z "$dh" ] || export DOCKER_HOST="$dh"
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
# 1. The LaunchDaemon first, so the agent cannot start new lanes while they are removed.
|
|
40
|
+
if command -v launchctl >/dev/null 2>&1 && { [ -e "$PLIST" ] || launchctl print "system/${LABEL}" >/dev/null 2>&1; }; then
|
|
41
|
+
run launchctl bootout "system/${LABEL}"
|
|
42
|
+
fi
|
|
43
|
+
del "$PLIST"
|
|
44
|
+
|
|
45
|
+
# 2. Docker objects carrying this agent's label (#5881), plus the lane images.
|
|
46
|
+
if command -v docker >/dev/null 2>&1 && docker info >/dev/null 2>&1; then
|
|
47
|
+
if [ -n "$AGENT_ID" ]; then
|
|
48
|
+
for c in $(docker ps -a --filter "label=computeshare.agent=${AGENT_ID}" --format '{{.Names}}'); do run docker rm -f -v "$c"; done
|
|
49
|
+
for v in $(docker volume ls -q --filter "label=computeshare.agent=${AGENT_ID}"); do run docker volume rm -f "$v"; done
|
|
50
|
+
else
|
|
51
|
+
log "no agent.json: lane containers and volumes are left alone (cannot tell this agent's from another's)"
|
|
52
|
+
fi
|
|
53
|
+
for i in $(docker image ls --format '{{.Repository}}:{{.Tag}}' forgedock-lane); do run docker image rm -f "$i"; done
|
|
54
|
+
else
|
|
55
|
+
log "docker not reachable: no containers, volumes or images to remove"
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
# 3. Code (with node), config (agent token) and state.
|
|
59
|
+
del "$ROOT" "$ETC" "$STATE"
|
|
60
|
+
if [ "$DRY" = 1 ]; then log "dry run: nothing removed"; else log "agent removed. Remove it from the router with: forgedock pool remove ${AGENT_ID:-<agent>}"; fi
|
|
@@ -13,6 +13,7 @@ Get-Process powershell -ErrorAction SilentlyContinue | Where-Object { $_.Command
|
|
|
13
13
|
Get-NetFirewallRule -Name 'computeshare-agent' -ErrorAction SilentlyContinue | Remove-NetFirewallRule
|
|
14
14
|
if (Get-Command Get-NetFirewallHyperVRule -ErrorAction SilentlyContinue) { Get-NetFirewallHyperVRule -ErrorAction SilentlyContinue | Where-Object { $_.DisplayName -like 'computeshare*' -or $_.Name -like '*computeshare*' } | ForEach-Object { Remove-NetFirewallHyperVRule -Name $_.Name -ErrorAction SilentlyContinue } }
|
|
15
15
|
(netsh interface portproxy show v4tov4) -match " $Port " | ForEach-Object { $a = ($_ -split '\s+')[0]; if ($a) { netsh interface portproxy delete v4tov4 listenaddress=$a listenport=$Port | Out-Null } }
|
|
16
|
+
# #5884: the distro (and its sparse vhdx) goes with --unregister; the [experimental] sparseVhd key is reverted by the .wslconfig backup restore below.
|
|
16
17
|
& wsl.exe --unregister $Distro
|
|
17
18
|
$cfg = Join-Path $env:USERPROFILE '.wslconfig'
|
|
18
19
|
if (Test-Path "$cfg.computeshare-backup") { Move-Item "$cfg.computeshare-backup" $cfg -Force; Write-Host 'Restored .wslconfig from backup (takes effect after wsl --shutdown).' }
|
|
@@ -471,6 +471,17 @@ fi
|
|
|
471
471
|
if [ "$TARGET_STATE" = "awaiting-merge" ]; then
|
|
472
472
|
echo "Clearing needs-human (best-effort, scoped to awaiting-merge)..."
|
|
473
473
|
gh issue edit "$ISSUE_NUMBER" "${GH_ARGS[@]}" --remove-label "needs-human" 2>/dev/null || true
|
|
474
|
+
elif [ "$TARGET_STATE" = "merged" ]; then
|
|
475
|
+
# forge#5759: a merged issue keeps no park labels (needs-human, needs-human:*, parked:*, remediation-queue); one call per label so
|
|
476
|
+
# one failure leaves the rest removed
|
|
477
|
+
echo "Clearing park labels (best-effort, merged)..."
|
|
478
|
+
IFS=',' read -ra MERGED_CURRENT <<< "${CURRENT_ISSUE_LABELS:-}"
|
|
479
|
+
for lbl in "${MERGED_CURRENT[@]}"; do
|
|
480
|
+
case "$lbl" in
|
|
481
|
+
needs-human|needs-human:*|parked:*|remediation-queue)
|
|
482
|
+
gh issue edit "$ISSUE_NUMBER" "${GH_ARGS[@]}" --remove-label "$lbl" 2>/dev/null || echo "WARN: could not remove '$lbl' from issue #$ISSUE_NUMBER" >&2 ;;
|
|
483
|
+
esac
|
|
484
|
+
done
|
|
474
485
|
else
|
|
475
486
|
echo "Skipping needs-human clear — TARGET_STATE is '$TARGET_STATE', not 'awaiting-merge'."
|
|
476
487
|
fi
|