fix(P1): clean disk before release + fallback to existing binary
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:
+25
-10
@@ -100,8 +100,6 @@ case "$JOB" in
|
||||
# ── release ────────────────────────────────────────────────────────
|
||||
release)
|
||||
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"
|
||||
|
||||
if [ -z "${GITEA_TOKEN:-${CI_GITEA_TOKEN:-}}" ]; then
|
||||
@@ -109,19 +107,36 @@ case "$JOB" in
|
||||
fi
|
||||
GITEA_TOKEN="${GITEA_TOKEN:-${CI_GITEA_TOKEN:-}}"
|
||||
|
||||
info "building release binary ${VERSION}..."
|
||||
info "GITEA_TOKEN length: ${#GITEA_TOKEN}"
|
||||
info "CI_COMMIT_BRANCH=${CI_COMMIT_BRANCH:-unset}"
|
||||
info "CI_COMMIT_SHA=${CI_COMMIT_SHA:-unset}"
|
||||
info "release ${VERSION} — GITEA_TOKEN length: ${#GITEA_TOKEN}"
|
||||
|
||||
# Clean up disk space — CoreCI's SQLite logging can fill the disk.
|
||||
# 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 \
|
||||
-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.buildTime=${BUILD_TIME}"
|
||||
mkdir -p bin
|
||||
go build -trimpath -ldflags="${LDFLAGS}" -o bin/orca ./cmd/orca 2>&1 || err "go build failed"
|
||||
tar -czf "${TARBALL}" -C bin orca
|
||||
sha256sum "${TARBALL}" > SHA256SUMS
|
||||
info "built ${TARBALL} ($(wc -c < "${TARBALL}") bytes)"
|
||||
go build -trimpath -ldflags="${LDFLAGS}" -o bin/orca ./cmd/orca 2>&1
|
||||
BUILD_EXIT=$?
|
||||
if [ ${BUILD_EXIT} -ne 0 ]; then
|
||||
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.
|
||||
# The CIAgent ship workflow may have already created the release
|
||||
|
||||
Reference in New Issue
Block a user