This commit is contained in:
Mateusz Gruszczyński committed 2026-11-03 10:38:23 +01:00
1 parent fb5f01d291
commit 7168bc4683
10 files changed
+370 -72

No files matched your search

+13 -6
View File
@@ -15,21 +15,26 @@ BUILD_FREEBSD=${5:-0}
SHORT_SHA=${SHA:0:12}
BUILD_ID="$(date -u '+%Y%m%dT%H%M%SZ')-${SHORT_SHA}"
WORK="$DATA_DIR/work/$BUILD_ID"
BUILD_TMP_DIR=${BUILD_TMP_DIR:-/tmp/rust-package-builder}
export CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-$BUILD_TMP_DIR/cargo-target}
WORK="$BUILD_TMP_DIR/work/$BUILD_ID"
SRC="$WORK/source"
PKG="$WORK/package"
OUT="$WORK/out"
cleanup() {
if [[ "${KEEP_WORKSPACE:-0}" != "1" ]]; then
rm -rf "$WORK"
rm -rf -- "$WORK"
else
log "workspace kept: $WORK"
fi
if is_true "${CLEAN_BUILD_CACHE:-1}"; then
rm -rf -- "$CARGO_TARGET_DIR" "${GOCACHE:-$BUILD_TMP_DIR/go-cache}"
fi
}
trap cleanup EXIT
mkdir -p "$SRC" "$PKG" "$OUT"
mkdir -p "$SRC" "$PKG" "$OUT" "$CARGO_TARGET_DIR"
log "cloning source"
git clone --quiet --no-tags --single-branch --branch "$SOURCE_BRANCH" "$SOURCE_REPO" "$SRC"
@@ -113,7 +118,6 @@ FREEBSD_OK=1
if [[ "$BUILD_LINUX" == "1" ]]; then
if /opt/rust-package-builder/scripts/build-linux-release.sh; then
log "Linux branch completed for $SHA"
cleanup_cargo_target
else
LINUX_OK=0
log "ERROR: Linux branch failed for $SHA; OPNsense branch will still run"
@@ -123,7 +127,6 @@ fi
if [[ "$BUILD_OPNSENSE" == "1" ]]; then
if /opt/rust-package-builder/scripts/build-opnsense-release.sh; then
log "OPNsense branch completed for $SHA"
cleanup_cargo_target
else
OPNSENSE_OK=0
log "ERROR: OPNsense branch failed for $SHA"
@@ -133,7 +136,6 @@ fi
if [[ "$BUILD_FREEBSD" == "1" ]]; then
if /opt/rust-package-builder/scripts/build-freebsd-release.sh; then
log "FreeBSD native branch completed for $SHA"
cleanup_cargo_target
else
FREEBSD_OK=0
log "ERROR: FreeBSD native branch failed for $SHA"
@@ -151,6 +153,11 @@ if [[ "$LINUX_STATE" == "$SHA" && "$OPNSENSE_STATE" == "$SHA" && ( "${FREEBSD_NA
log "all branches complete for $SHA"
fi
# Every branch publication creates an atomic repository snapshot. Keep only
# the newest configured set while always protecting the snapshot currently
# served through repository/current.
prune_release_dirs "$DATA_DIR/repository/releases" "${RELEASE_RETENTION:-10}" "$(readlink -f "$DATA_DIR/repository/current" 2>/dev/null || true)"
if [[ "$LINUX_OK" != "1" || "$OPNSENSE_OK" != "1" || "$FREEBSD_OK" != "1" ]]; then
exit 1
fi