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}"
|
info "release ${VERSION} — GITEA_TOKEN length: ${#GITEA_TOKEN}"
|
||||||
|
|
||||||
# Clean up disk space — CoreCI's SQLite logging can fill the disk.
|
# Clean up disk space — CoreCI's SQLite logging fills the disk.
|
||||||
# Remove coverage.out and Go build cache to free space.
|
|
||||||
rm -f coverage.out 2>/dev/null || true
|
rm -f coverage.out 2>/dev/null || true
|
||||||
go clean -cache 2>/dev/null || true
|
go clean -cache 2>/dev/null || true
|
||||||
|
|
||||||
# Rebuild the binary (the build job's binary may not persist if the
|
# Use the binary built by the 'build' job (it shares the same workdir).
|
||||||
# executor uses separate workdirs, or the disk was full).
|
# Rebuild only if the binary doesn't exist.
|
||||||
info "building release binary..."
|
if [ ! -x bin/orca ]; then
|
||||||
GIT_COMMIT="${CI_COMMIT_SHA:-unknown}"
|
info "bin/orca not found — rebuilding..."
|
||||||
BUILD_TIME="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
GIT_COMMIT="${CI_COMMIT_SHA:-unknown}"
|
||||||
LDFLAGS="-s -w \
|
BUILD_TIME="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||||
-X git.cloudinit.dev/coreci/orca/internal/cli.version=${VERSION} \
|
LDFLAGS="-s -w \
|
||||||
-X git.cloudinit.dev/coreci/orca/internal/cli.gitCommit=${GIT_COMMIT} \
|
-X git.cloudinit.dev/coreci/orca/internal/cli.version=${VERSION} \
|
||||||
-X git.cloudinit.dev/coreci/orca/internal/cli.buildTime=${BUILD_TIME}"
|
-X git.cloudinit.dev/coreci/orca/internal/cli.gitCommit=${GIT_COMMIT} \
|
||||||
mkdir -p bin
|
-X git.cloudinit.dev/coreci/orca/internal/cli.buildTime=${BUILD_TIME}"
|
||||||
go build -trimpath -ldflags="${LDFLAGS}" -o bin/orca ./cmd/orca 2>&1
|
mkdir -p bin
|
||||||
BUILD_EXIT=$?
|
go build -trimpath -ldflags="${LDFLAGS}" -o bin/orca ./cmd/orca 2>&1 || err "go build failed"
|
||||||
if [ ${BUILD_EXIT} -ne 0 ]; then
|
else
|
||||||
info "go build failed (exit ${BUILD_EXIT}) — trying with existing bin/orca from build job"
|
info "using 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
|
fi
|
||||||
tar -czf "${TARBALL}" -C bin orca 2>&1 || err "tar failed"
|
tar -czf "${TARBALL}" -C bin orca 2>&1 || err "tar failed"
|
||||||
sha256sum "${TARBALL}" > SHA256SUMS 2>&1 || err "sha256sum failed"
|
sha256sum "${TARBALL}" > SHA256SUMS 2>&1 || err "sha256sum failed"
|
||||||
|
|||||||
Reference in New Issue
Block a user