fix(P1): clean disk before release + fallback to existing binary
Release / ci (push) Failing after 8m5s
Release / container-orca (push) Has been skipped
Release / container-traefik (push) Has been skipped

The release job fails in 5 seconds — likely due to disk full (CoreCI's
SQLite logging fills the disk during go test -race). Fix:
1. Clean up coverage.out and Go build cache before the release job
2. If go build fails (disk full), fall back to the existing bin/orca
   from the build job (which succeeded)
3. Add more error handling for tar/sha256sum

---ci---
project: orca
phase: 1
milestone: v0.16
status: execute
---/ci---
This commit is contained in:
Jon Chery
2026-08-12 22:18:45 +00:00
parent 5c07fafa18
commit 8ca5ffd0fc
+25 -10
View File
@@ -100,8 +100,6 @@ case "$JOB" in
# ── release ──────────────────────────────────────────────────────── # ── release ────────────────────────────────────────────────────────
release) release)
VERSION="${CI_COMMIT_BRANCH:-dev}" VERSION="${CI_COMMIT_BRANCH:-dev}"
GIT_COMMIT="${CI_COMMIT_SHA:-unknown}"
BUILD_TIME="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
TARBALL="orca-${VERSION}-linux-amd64.tar.gz" TARBALL="orca-${VERSION}-linux-amd64.tar.gz"
if [ -z "${GITEA_TOKEN:-${CI_GITEA_TOKEN:-}}" ]; then if [ -z "${GITEA_TOKEN:-${CI_GITEA_TOKEN:-}}" ]; then
@@ -109,19 +107,36 @@ case "$JOB" in
fi fi
GITEA_TOKEN="${GITEA_TOKEN:-${CI_GITEA_TOKEN:-}}" GITEA_TOKEN="${GITEA_TOKEN:-${CI_GITEA_TOKEN:-}}"
info "building release binary ${VERSION}..." info "release ${VERSION} — GITEA_TOKEN length: ${#GITEA_TOKEN}"
info "GITEA_TOKEN length: ${#GITEA_TOKEN}"
info "CI_COMMIT_BRANCH=${CI_COMMIT_BRANCH:-unset}" # Clean up disk space — CoreCI's SQLite logging can fill the disk.
info "CI_COMMIT_SHA=${CI_COMMIT_SHA:-unset}" # Remove coverage.out and Go build cache to free space.
rm -f coverage.out 2>/dev/null || true
go clean -cache 2>/dev/null || true
# Rebuild the binary (the build job's binary may not persist if the
# executor uses separate workdirs, or the disk was full).
info "building release binary..."
GIT_COMMIT="${CI_COMMIT_SHA:-unknown}"
BUILD_TIME="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
LDFLAGS="-s -w \ LDFLAGS="-s -w \
-X git.cloudinit.dev/coreci/orca/internal/cli.version=${VERSION} \ -X git.cloudinit.dev/coreci/orca/internal/cli.version=${VERSION} \
-X git.cloudinit.dev/coreci/orca/internal/cli.gitCommit=${GIT_COMMIT} \ -X git.cloudinit.dev/coreci/orca/internal/cli.gitCommit=${GIT_COMMIT} \
-X git.cloudinit.dev/coreci/orca/internal/cli.buildTime=${BUILD_TIME}" -X git.cloudinit.dev/coreci/orca/internal/cli.buildTime=${BUILD_TIME}"
mkdir -p bin mkdir -p bin
go build -trimpath -ldflags="${LDFLAGS}" -o bin/orca ./cmd/orca 2>&1 || err "go build failed" go build -trimpath -ldflags="${LDFLAGS}" -o bin/orca ./cmd/orca 2>&1
tar -czf "${TARBALL}" -C bin orca BUILD_EXIT=$?
sha256sum "${TARBALL}" > SHA256SUMS if [ ${BUILD_EXIT} -ne 0 ]; then
info "built ${TARBALL} ($(wc -c < "${TARBALL}") bytes)" info "go build failed (exit ${BUILD_EXIT}) — trying with existing bin/orca from build job"
if [ -x bin/orca ]; then
info "found existing bin/orca from build job"
else
err "go build failed and no existing binary found"
fi
fi
tar -czf "${TARBALL}" -C bin orca 2>&1 || err "tar failed"
sha256sum "${TARBALL}" > SHA256SUMS 2>&1 || err "sha256sum failed"
info "built ${TARBALL}"
# Create or update the Gitea release directly via the API. # Create or update the Gitea release directly via the API.
# The CIAgent ship workflow may have already created the release # The CIAgent ship workflow may have already created the release