fix(P1): release job uses existing bin/orca from build job
The release job's go build fails due to disk full (CoreCI's SQLite logging fills the disk during go test -race). The build job already builds bin/orca successfully — the release job should just package it and upload. Only rebuild if bin/orca doesn't exist. ---ci--- project: orca phase: 1 milestone: v0.16 status: execute ---/ci---
This commit is contained in:
+15
-21
@@ -109,30 +109,24 @@ case "$JOB" in
|
||||
|
||||
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.
|
||||
# Clean up disk space — CoreCI's SQLite logging fills the disk.
|
||||
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
|
||||
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
|
||||
# Use the binary built by the 'build' job (it shares the same workdir).
|
||||
# Rebuild only if the binary doesn't exist.
|
||||
if [ ! -x bin/orca ]; then
|
||||
info "bin/orca not found — rebuilding..."
|
||||
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"
|
||||
else
|
||||
info "using existing bin/orca from build job"
|
||||
fi
|
||||
tar -czf "${TARBALL}" -C bin orca 2>&1 || err "tar failed"
|
||||
sha256sum "${TARBALL}" > SHA256SUMS 2>&1 || err "sha256sum failed"
|
||||
|
||||
Reference in New Issue
Block a user