build.yml: 2-wide parallel build waves + 8-binary guard; widen ls-remote/raw-verify stall margins; accurate rollout ntfy text
Some checks failed
build-agent / build (push) Failing after 1m30s
Some checks failed
build-agent / build (push) Failing after 1m30s
This commit is contained in:
@@ -63,7 +63,7 @@ jobs:
|
|||||||
# --- newest upstream semver tag (3 attempts x 120s cap: github hiccups) ---
|
# --- newest upstream semver tag (3 attempts x 120s cap: github hiccups) ---
|
||||||
VER=""
|
VER=""
|
||||||
for i in 1 2 3; do
|
for i in 1 2 3; do
|
||||||
VER="$(GIT_TERMINAL_PROMPT=0 timeout 120 git ls-remote --tags "$UP" 2>/dev/null \
|
VER="$(GIT_TERMINAL_PROMPT=0 timeout 180 git ls-remote --tags "$UP" 2>/dev/null \
|
||||||
| awk '{print $2}' | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | sort -uV | tail -1 || true)"
|
| awk '{print $2}' | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | sort -uV | tail -1 || true)"
|
||||||
[ -n "$VER" ] && break
|
[ -n "$VER" ] && break
|
||||||
echo "upstream tag scan attempt $i failed; retrying in 60s"
|
echo "upstream tag scan attempt $i failed; retrying in 60s"
|
||||||
@@ -79,7 +79,7 @@ jobs:
|
|||||||
# --- idempotency: already published here? (2 attempts: gitea stalls observed) ---
|
# --- idempotency: already published here? (2 attempts: gitea stalls observed) ---
|
||||||
PUBLISHED=""
|
PUBLISHED=""
|
||||||
for i in 1 2; do
|
for i in 1 2; do
|
||||||
PUBLISHED="$(authgit 90 ls-remote --tags "$API/$REPO.git" 2>/dev/null \
|
PUBLISHED="$(authgit 120 ls-remote --tags "$API/$REPO.git" 2>/dev/null \
|
||||||
| grep -E "refs/tags/${VER}\$" || true)"
|
| grep -E "refs/tags/${VER}\$" || true)"
|
||||||
[ -n "$PUBLISHED" ] && break
|
[ -n "$PUBLISHED" ] && break
|
||||||
echo "gitea tag check attempt $i inconclusive; retrying in 45s"
|
echo "gitea tag check attempt $i inconclusive; retrying in 45s"
|
||||||
@@ -91,7 +91,7 @@ jobs:
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
# a second inconclusive gitea check is NOT proof of absence: fail loudly
|
# a second inconclusive gitea check is NOT proof of absence: fail loudly
|
||||||
if ! authgit 90 ls-remote --tags "$API/$REPO.git" >/dev/null 2>&1; then
|
if ! authgit 120 ls-remote --tags "$API/$REPO.git" >/dev/null 2>&1; then
|
||||||
echo "could not verify existing tags after retries; refusing to rebuild (gitea unreachable/stalled)"
|
echo "could not verify existing tags after retries; refusing to rebuild (gitea unreachable/stalled)"
|
||||||
echo "failed" > /tmp/agentbuilds-status
|
echo "failed" > /tmp/agentbuilds-status
|
||||||
exit 1
|
exit 1
|
||||||
@@ -102,16 +102,30 @@ jobs:
|
|||||||
GIT_TERMINAL_PROMPT=0 timeout 300 git clone --quiet --depth 1 --branch "$VER" "$UP" "$W/src"
|
GIT_TERMINAL_PROMPT=0 timeout 300 git clone --quiet --depth 1 --branch "$VER" "$UP" "$W/src"
|
||||||
(
|
(
|
||||||
cd "$W/src"
|
cd "$W/src"
|
||||||
for t in linux/amd64 linux/arm64 linux/arm linux/386 \
|
b() {
|
||||||
darwin/amd64 darwin/arm64 windows/amd64 windows/386; do
|
t="$1"; GOOS="${t%%/*}"; GOARCH="${t##*/}"
|
||||||
GOOS="${t%%/*}"; GOARCH="${t##*/}"
|
|
||||||
EXE=""; [ "$GOOS" = "windows" ] && EXE=".exe"
|
EXE=""; [ "$GOOS" = "windows" ] && EXE=".exe"
|
||||||
echo "=== go build $GOOS/$GOARCH ==="
|
echo "=== go build $GOOS/$GOARCH ==="
|
||||||
CGO_ENABLED=0 GOOS="$GOOS" GOARCH="$GOARCH" \
|
CGO_ENABLED=0 GOOS="$GOOS" GOARCH="$GOARCH" \
|
||||||
timeout 900 go build -ldflags "-s -w" \
|
timeout 900 go build -ldflags "-s -w" \
|
||||||
-o "$W/dist/tacticalagent-$VER-$GOOS-$GOARCH$EXE" .
|
-o "$W/dist/tacticalagent-$VER-$GOOS-$GOARCH$EXE" . || {
|
||||||
done
|
echo "BUILD FAILED $GOOS/$GOARCH" >&2; exit 1; }
|
||||||
|
}
|
||||||
|
# 4 waves of 2 (proven pattern; much faster than serial on the runner)
|
||||||
|
( b linux/amd64; b linux/arm64 ) &
|
||||||
|
( b linux/arm; b linux/386 ) &
|
||||||
|
wait
|
||||||
|
( b darwin/amd64; b darwin/arm64 ) &
|
||||||
|
( b windows/amd64; b windows/386 ) &
|
||||||
|
wait
|
||||||
)
|
)
|
||||||
|
# hard guard: all 8 targets must exist before publish (POSIX sh `wait`
|
||||||
|
# does not propagate child failures, so verify the artifacts)
|
||||||
|
n="$(ls "$W/dist" | grep -c '^tacticalagent-' || true)"
|
||||||
|
if [ "$n" != "8" ]; then
|
||||||
|
echo "expected 8 built binaries, found $n" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
( cd "$W/dist" && sha256sum tacticalagent-* > SHA256SUMS )
|
( cd "$W/dist" && sha256sum tacticalagent-* > SHA256SUMS )
|
||||||
|
|
||||||
# --- publish into this repo (public; agents fetch the raw URLs) ---
|
# --- publish into this repo (public; agents fetch the raw URLs) ---
|
||||||
@@ -142,7 +156,7 @@ jobs:
|
|||||||
# busybox curl has no -w: use -f (exit 22 on HTTP >=400) as the pass/fail signal
|
# busybox curl has no -w: use -f (exit 22 on HTTP >=400) as the pass/fail signal
|
||||||
for f in "$W/dist"/tacticalagent-*; do
|
for f in "$W/dist"/tacticalagent-*; do
|
||||||
n="$(basename "$f")"
|
n="$(basename "$f")"
|
||||||
if curl -sf -m 30 -o /dev/null "$API/$REPO/raw/branch/$VER/dist/$VER/$n"; then
|
if curl -sf -m 60 -o /dev/null "$API/$REPO/raw/branch/$VER/dist/$VER/$n"; then
|
||||||
echo "raw 200: $n"
|
echo "raw 200: $n"
|
||||||
else
|
else
|
||||||
rc=$?
|
rc=$?
|
||||||
@@ -162,7 +176,7 @@ jobs:
|
|||||||
curl -s -m 5 "http://10.2.1.10/izebra" \
|
curl -s -m 5 "http://10.2.1.10/izebra" \
|
||||||
-H "X-Title: agent-builds: $VER published" \
|
-H "X-Title: agent-builds: $VER published" \
|
||||||
-H 'X-Priority: 3' -H 'X-Tag: rocket' \
|
-H 'X-Priority: 3' -H 'X-Tag: rocket' \
|
||||||
--data "Published TacticalRMM agent $VER (8 targets) to git.izebra.net/izebra_projects/agent-builds. RMM2 LATEST_AGENT_VER is 2.12.0; bump it to $VER when the rollout is ready." || true
|
--data "Published TacticalRMM agent $VER (8 targets) to git.izebra.net/izebra_projects/agent-builds. RMM2's LATEST_AGENT_VER gate (tacticalrmm settings) controls rollout; bump it to $VER when ready." || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Alert
|
- name: Alert
|
||||||
|
|||||||
Reference in New Issue
Block a user