Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Compile release payloads in parallel on PVE

rcourtmand44c15a4fd6f
diff --git a/.github/workflows/build-release-candidate.yml b/.github/workflows/build-release-candidate.yml
index 1a6735a865..aaee044677 100644
--- a/.github/workflows/build-release-candidate.yml
+++ b/.github/workflows/build-release-candidate.yml
@@ -1,6 +1,30 @@
name: Build Release Candidate
on:
+ workflow_dispatch:
+ inputs:
+ version:
+ description: 'Version number without the leading v'
+ required: true
+ type: string
+ require_macos_signing:
+ description: 'Require Developer ID signed and notarized macOS agent binaries'
+ required: false
+ default: false
+ type: boolean
+ require_windows_signing:
+ description: 'Require Authenticode-signed Windows agent binaries'
+ required: false
+ default: false
+ type: boolean
+ windows_signing_backend:
+ description: 'Windows signing backend: signpath (canonical) or legacy-pfx (break-glass fallback)'
+ required: false
+ default: signpath
+ type: choice
+ options:
+ - signpath
+ - legacy-pfx
workflow_call:
inputs:
version:
@@ -37,6 +61,51 @@ permissions:
contents: read
jobs:
+ compile-release-payload:
+ name: Compile Exact-SHA Release Payload on PVE
+ runs-on: [self-hosted, Linux, X64, pulse-pve-compile]
+ timeout-minutes: 20
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
+ with:
+ fetch-depth: 0
+
+ - name: Validate candidate identity
+ run: |
+ set -euo pipefail
+ test "$(tr -d '\n' < VERSION)" = "${{ inputs.version }}"
+ test "$(git rev-parse HEAD)" = "${GITHUB_SHA}"
+
+ - name: Set up Go
+ uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
+ with:
+ go-version-file: go.mod
+ cache: true
+
+ - name: Set up Node.js
+ uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
+ with:
+ node-version: '20'
+ cache: 'npm'
+ cache-dependency-path: 'frontend-modern/package-lock.json'
+
+ - name: Compile credential-free release payload
+ env:
+ PULSE_LICENSE_PUBLIC_KEY: ${{ secrets.PULSE_LICENSE_PUBLIC_KEY }}
+ PULSE_UPDATE_SIGNING_PUBLIC_KEY: ${{ vars.PULSE_UPDATE_SIGNING_PUBLIC_KEY }}
+ run: ./scripts/build-release-binaries.sh "${{ inputs.version }}" "$RUNNER_TEMP/release-compiled"
+
+ - name: Upload exact-SHA compiled payload
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ with:
+ name: release-compiled-${{ github.sha }}-${{ inputs.version }}
+ path: ${{ runner.temp }}/release-compiled/
+ if-no-files-found: error
+ retention-days: 1
+ compression-level: 0
+ overwrite: true
+
signing-configuration:
name: Verify Native Signing Configuration
if: ${{ inputs.require_macos_signing || inputs.require_windows_signing }}
@@ -486,8 +555,8 @@ jobs:
build:
name: Build and Validate Release Candidate
- needs: [sign-macos-agent, collect-windows-signing]
- if: ${{ always() && (!inputs.require_macos_signing || needs.sign-macos-agent.result == 'success') && (!inputs.require_windows_signing || needs.collect-windows-signing.result == 'success') }}
+ needs: [compile-release-payload, sign-macos-agent, collect-windows-signing]
+ if: ${{ always() && needs.compile-release-payload.result == 'success' && (!inputs.require_macos_signing || needs.sign-macos-agent.result == 'success') && (!inputs.require_windows_signing || needs.collect-windows-signing.result == 'success') }}
runs-on: ubuntu-24.04
timeout-minutes: 60
outputs:
@@ -549,6 +618,20 @@ jobs:
tar -xzf "${TMP_DIR}/${SYFT_ARCHIVE}" -C "${TMP_DIR}" syft
install -m 0755 "${TMP_DIR}/syft" /usr/local/bin/syft
+ - name: Download exact-SHA compiled payload
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
+ with:
+ name: release-compiled-${{ github.sha }}-${{ inputs.version }}
+ path: release-compiled
+
+ - name: Verify exact-SHA compiled payload
+ run: |
+ python3 scripts/release_candidate_manifest.py verify-local \
+ --release-dir release-compiled/payload \
+ --manifest release-compiled/manifest/release-compiled.json \
+ --version "${{ inputs.version }}" \
+ --source-sha "${GITHUB_SHA}"
+
- name: Download signed macOS binaries
if: ${{ inputs.require_macos_signing }}
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
@@ -579,6 +662,7 @@ jobs:
PULSE_REQUIRE_MACOS_SIGNING: ${{ inputs.require_macos_signing }}
PULSE_REQUIRE_WINDOWS_SIGNING: ${{ inputs.require_windows_signing }}
PULSE_AGENT_NATIVE_BINARIES_DIR: ${{ (inputs.require_macos_signing || inputs.require_windows_signing) && format('{0}/native-agent-binaries', github.workspace) || '' }}
+ PULSE_RELEASE_COMPILED_PAYLOAD_DIR: ${{ github.workspace }}/release-compiled/payload
- name: Validate installer signing key pins
env:
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index 264c91a08e..794838e57a 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -92,8 +92,10 @@ discarding existing explicit disk exclusions.
34. `go.mod`
35. `go.sum`
36. `scripts/build-release.sh`
-37. `scripts/run-release-backend-tests.sh`
-38. `scripts/shard_go_tests.py`
+37. `scripts/build-release-binaries.sh`
+38. `scripts/release_build_targets.sh`
+39. `scripts/run-release-backend-tests.sh`
+40. `scripts/shard_go_tests.py`
37. `scripts/generate-release-notes.sh`
37. `scripts/check-workflow-dispatch-inputs.py`
38. `scripts/clean-mock-alerts.sh`
@@ -487,7 +489,7 @@ upgrade, update, release, or artifact-selection behavior.
## Extension Points
1. Add or change deployment-type detection, update planning, or apply behavior through `internal/updates/`
-2. Add or change release-build metadata injection, Docker build-context allowlists, release artifact assembly, governed promotion metadata resolution, artifact release-line validation, post-install live-runtime claim proof, the canonical version file, operator-facing release packet content, prerelease feedback intake wording, historical published-release integrity backfill, release asset validation status publication, download endpoint checksum/signature header proof, end-to-end install.sh smoke against staged or published release assets, or the canonical in-repo v6 upgrade guide through `scripts/build-release.sh`, `scripts/run-release-backend-tests.sh`, `scripts/shard_go_tests.py`, `scripts/release_asset_common.sh`, `scripts/backfill-release-assets.sh`, `scripts/release_ldflags.sh`, `scripts/check-workflow-dispatch-inputs.py`, `scripts/release-preflight-worker.sh`, `scripts/run-release-preflight.sh`, `scripts/release_control/live_runtime_proof.py`, `scripts/release_control/live_runtime_proof_test.py`, `scripts/release_control/mobile_release_gate.py`, `scripts/release_control/render_release_body.py`, `scripts/release_control/resolve_release_promotion.py`, `scripts/release_control/validate_artifact_release_line.py`, `scripts/release_control/record_rc_to_ga_rehearsal.py`, `scripts/release_control/internal/record_rc_to_ga_rehearsal.py`, `scripts/release_control/release_promotion_policy_support.py`, `.dockerignore`, `Dockerfile`, `.github/ISSUE_TEMPLATE/v6_rc_feedback.yml`, `docs/RELEASE_NOTES.md`, `docs/releases/`, `docs/UPGRADE_v6.md`, `docs/release-control/v6/internal/RELEASE_PROMOTION_POLICY.md`, `docs/release-control/v6/internal/PRE_RELEASE_CHECKLIST.md`, `docs/release-control/v6/internal/RC_TO_GA_REHEARSAL_TEMPLATE.md`, `scripts/validate-release.sh`, `scripts/validate-published-release.sh`, the operator dispatch helpers `scripts/trigger-release.sh` and `scripts/trigger-release-dry-run.sh`, and the governed release workflows `.github/workflows/backfill-release-assets.yml`, `.github/workflows/create-release.yml`, `.github/workflows/deploy-demo-server.yml`, `.github/workflows/helm-pages.yml`, `.github/workflows/install-sh-smoke.yml`, `.github/workflows/promote-floating-tags.yml`, `.github/workflows/promote-private-pro-runtime.yml`, `.github/workflows/publish-docker.yml`, `.github/workflows/publish-helm-chart.yml`, `.github/workflows/release-convergence.yml`, `.github/workflows/release-dry-run.yml`, `.github/workflows/retry-release-convergence.yml`, `.github/workflows/update-demo-server.yml`, and `.github/workflows/validate-release-assets.yml`
+2. Add or change release-build metadata injection, Docker build-context allowlists, release artifact assembly, governed promotion metadata resolution, artifact release-line validation, post-install live-runtime claim proof, the canonical version file, operator-facing release packet content, prerelease feedback intake wording, historical published-release integrity backfill, release asset validation status publication, download endpoint checksum/signature header proof, end-to-end install.sh smoke against staged or published release assets, or the canonical in-repo v6 upgrade guide through `scripts/build-release.sh`, `scripts/build-release-binaries.sh`, `scripts/release_build_targets.sh`, `scripts/run-release-backend-tests.sh`, `scripts/shard_go_tests.py`, `scripts/release_asset_common.sh`, `scripts/backfill-release-assets.sh`, `scripts/release_ldflags.sh`, `scripts/check-workflow-dispatch-inputs.py`, `scripts/release-preflight-worker.sh`, `scripts/run-release-preflight.sh`, `scripts/release_control/live_runtime_proof.py`, `scripts/release_control/live_runtime_proof_test.py`, `scripts/release_control/mobile_release_gate.py`, `scripts/release_control/render_release_body.py`, `scripts/release_control/resolve_release_promotion.py`, `scripts/release_control/validate_artifact_release_line.py`, `scripts/release_control/record_rc_to_ga_rehearsal.py`, `scripts/release_control/internal/record_rc_to_ga_rehearsal.py`, `scripts/release_control/release_promotion_policy_support.py`, `.dockerignore`, `Dockerfile`, `.github/ISSUE_TEMPLATE/v6_rc_feedback.yml`, `docs/RELEASE_NOTES.md`, `docs/releases/`, `docs/UPGRADE_v6.md`, `docs/release-control/v6/internal/RELEASE_PROMOTION_POLICY.md`, `docs/release-control/v6/internal/PRE_RELEASE_CHECKLIST.md`, `docs/release-control/v6/internal/RC_TO_GA_REHEARSAL_TEMPLATE.md`, `scripts/validate-release.sh`, `scripts/validate-published-release.sh`, the operator dispatch helpers `scripts/trigger-release.sh` and `scripts/trigger-release-dry-run.sh`, and the governed release workflows `.github/workflows/backfill-release-assets.yml`, `.github/workflows/build-release-candidate.yml`, `.github/workflows/create-release.yml`, `.github/workflows/deploy-demo-server.yml`, `.github/workflows/helm-pages.yml`, `.github/workflows/install-sh-smoke.yml`, `.github/workflows/promote-floating-tags.yml`, `.github/workflows/promote-private-pro-runtime.yml`, `.github/workflows/publish-docker.yml`, `.github/workflows/publish-helm-chart.yml`, `.github/workflows/release-convergence.yml`, `.github/workflows/release-dry-run.yml`, `.github/workflows/retry-release-convergence.yml`, `.github/workflows/update-demo-server.yml`, and `.github/workflows/validate-release-assets.yml`
Operators may configure an external Linux amd64 worker for the two trigger
helpers. `scripts/run-release-preflight.sh` must resolve an immutable pushed
commit, stream the worker implementation stored in that commit over SSH,
@@ -516,6 +518,13 @@ upgrade, update, release, or artifact-selection behavior.
Signing, package publication, and release mutation authority must remain on
hosted jobs. The bundle job must be independent from frontend quality so
backend and browser-smoke lanes can start as soon as the bundle is available.
+ Cross-platform release compilation may run concurrently on a separate,
+ low-priority PVE identity using only public embedding keys. It must produce
+ one exact-version, exact-source-SHA manifest covering the complete frontend
+ and binary payload. The hosted candidate job must verify that manifest
+ before applying required native binaries, packaging, update-signing, SBOM
+ generation, validation, or upload. Private signing material and publication
+ credentials must never enter the PVE compilation job.
The backend runner must compile the race-enabled `internal/api` test binary
once, enumerate every top-level test from that exact binary, and generate a
deterministic manifest proving a complete, disjoint partition. Each
diff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.json
index a128a8116d..7adfc4c4fc 100644
--- a/docs/release-control/v6/internal/subsystems/registry.json
+++ b/docs/release-control/v6/internal/subsystems/registry.json
@@ -4197,6 +4197,7 @@
"pulse-pro:scripts/tests/test_validate_paid_runtime_distribution.py",
"pulse-pro:scripts/validate_paid_runtime_distribution.py",
"scripts/backfill-release-assets.sh",
+ "scripts/build-release-binaries.sh",
"scripts/build-release.sh",
"scripts/check-workflow-dispatch-inputs.py",
"scripts/clean-mock-alerts.sh",
@@ -4220,6 +4221,7 @@
"scripts/pulse-auto-update.sh",
"scripts/release-preflight-worker.sh",
"scripts/release_asset_common.sh",
+ "scripts/release_build_targets.sh",
"scripts/release_candidate_manifest.py",
"scripts/release_control/customer_promotion_lease.sh",
"scripts/release_control/internal/record_rc_to_ga_rehearsal.py",
@@ -4424,8 +4426,10 @@
".github/workflows/deploy-demo-server.yml",
"Dockerfile",
"scripts/backfill-release-assets.sh",
+ "scripts/build-release-binaries.sh",
"scripts/build-release.sh",
"scripts/release_asset_common.sh",
+ "scripts/release_build_targets.sh",
"scripts/release_ldflags.sh",
"scripts/validate-release.sh"
],
diff --git a/scripts/build-release-binaries.sh b/scripts/build-release-binaries.sh
new file mode 100755
index 0000000000..dab87c99e1
--- /dev/null
+++ b/scripts/build-release-binaries.sh
@@ -0,0 +1,208 @@
+#!/usr/bin/env bash
+
+# Build the credential-free release payload that can run in parallel with
+# platform-native signing. Packaging and release signing happen separately on
+# a hosted runner after this payload's exact-SHA manifest is verified.
+
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
+cd "${REPO_ROOT}"
+
+source "${SCRIPT_DIR}/release_build_targets.sh"
+
+VERSION="${1:-$(tr -d '\n\r[:space:]' < VERSION)}"
+OUTPUT_ROOT="${2:-}"
+if [[ -z "${OUTPUT_ROOT}" ]]; then
+ echo "Usage: $0 <version> <output-directory>" >&2
+ exit 2
+fi
+OUTPUT_ROOT="$(python3 -c 'import os, sys; print(os.path.abspath(sys.argv[1]))' "${OUTPUT_ROOT}")"
+case "${OUTPUT_ROOT}" in
+ /|"${REPO_ROOT}"|"${REPO_ROOT}/scripts")
+ echo "Error: refusing unsafe release compilation output: ${OUTPUT_ROOT}" >&2
+ exit 2
+ ;;
+esac
+
+required_go="go1.26.5"
+current_go="$(go env GOVERSION 2>/dev/null || true)"
+if [[ "${current_go}" != "${required_go}" ]]; then
+ echo "Error: Go toolchain must be ${required_go} (got ${current_go:-unknown})." >&2
+ exit 3
+fi
+for command_name in go npm python3 openssl getconf pgrep; do
+ command -v "${command_name}" >/dev/null 2>&1 || {
+ echo "Error: required release compilation command is missing: ${command_name}" >&2
+ exit 3
+ }
+done
+for variable_name in PULSE_LICENSE_PUBLIC_KEY PULSE_UPDATE_SIGNING_PUBLIC_KEY; do
+ if [[ -z "${!variable_name:-}" ]]; then
+ echo "Error: ${variable_name} is required for release compilation." >&2
+ exit 3
+ fi
+done
+
+decoded_key_len="$(printf '%s' "${PULSE_LICENSE_PUBLIC_KEY}" | openssl base64 -d -A 2>/dev/null | wc -c | tr -d ' ')"
+if [[ "${decoded_key_len}" != "32" ]]; then
+ echo "Error: PULSE_LICENSE_PUBLIC_KEY must decode to 32 bytes." >&2
+ exit 3
+fi
+
+SOURCE_SHA="$(git rev-parse HEAD)"
+if [[ ! "${SOURCE_SHA}" =~ ^[0-9a-f]{40}$ ]]; then
+ echo "Error: release compilation requires an exact Git commit." >&2
+ exit 3
+fi
+if [[ "$(tr -d '\n\r[:space:]' < VERSION)" != "${VERSION}" ]]; then
+ echo "Error: requested version ${VERSION} does not match VERSION." >&2
+ exit 3
+fi
+
+PAYLOAD_DIR="${OUTPUT_ROOT}/payload"
+BINARIES_DIR="${PAYLOAD_DIR}/binaries"
+FRONTEND_DIR="${PAYLOAD_DIR}/frontend-dist"
+MANIFEST_DIR="${OUTPUT_ROOT}/manifest"
+if [[ -e "${OUTPUT_ROOT}" ]] && find "${OUTPUT_ROOT}" -mindepth 1 -print -quit | grep -q .; then
+ echo "Error: release compilation output must be absent or empty: ${OUTPUT_ROOT}" >&2
+ exit 2
+fi
+mkdir -p "${BINARIES_DIR}" "${FRONTEND_DIR}" "${MANIFEST_DIR}"
+
+echo "Building exact-SHA frontend bundle..."
+npm --prefix frontend-modern ci
+npm --prefix frontend-modern run build
+cp -a frontend-modern/dist/. "${FRONTEND_DIR}/"
+
+export CGO_ENABLED=0
+release_go_build_args=(-buildvcs=false -trimpath)
+agent_ldflags="$(./scripts/release_ldflags.sh agent \
+ --version "v${VERSION}" \
+ --update-public-keys "${PULSE_UPDATE_SIGNING_PUBLIC_KEY}")"
+build_time="$(date -u '+%Y-%m-%d_%H:%M:%S')"
+git_commit="$(git rev-parse --short HEAD)"
+server_ldflags="$(./scripts/release_ldflags.sh server \
+ --version "v${VERSION}" \
+ --build-time "${build_time}" \
+ --git-commit "${git_commit}" \
+ --license-public-key "${PULSE_LICENSE_PUBLIC_KEY}" \
+ --update-public-keys "${PULSE_UPDATE_SIGNING_PUBLIC_KEY}")"
+
+vcpus="$(getconf _NPROCESSORS_ONLN 2>/dev/null || printf '1')"
+build_jobs="${PULSE_RELEASE_BUILD_JOBS:-$((vcpus / 2))}"
+if (( build_jobs < 1 )); then build_jobs=1; fi
+if (( build_jobs > 4 )); then build_jobs=4; fi
+go_procs="${PULSE_RELEASE_GO_PROCS:-$((vcpus / build_jobs))}"
+if (( go_procs < 1 )); then go_procs=1; fi
+echo "Compiling release matrix with ${build_jobs} workers and GOMAXPROCS=${go_procs} per worker..."
+
+declare -a task_components=()
+declare -a task_targets=()
+for target in "${PULSE_RELEASE_AGENT_TARGETS[@]}"; do
+ task_components+=(agent mcp)
+ task_targets+=("${target}" "${target}")
+done
+for target in "${PULSE_RELEASE_SERVER_TARGETS[@]}"; do
+ task_components+=(server)
+ task_targets+=("${target}")
+done
+
+build_one() {
+ local component="$1"
+ local target="$2"
+ local target_env output package ldflags
+ local -a target_env_parts command
+ target_env="$(pulse_release_target_env "${target}")"
+ output="${BINARIES_DIR}/$(pulse_release_binary_filename "${component}" "${target}")"
+ case "${component}" in
+ agent)
+ package=./cmd/pulse-agent
+ ldflags="${agent_ldflags}"
+ ;;
+ mcp)
+ package=./cmd/pulse-mcp
+ ldflags=""
+ ;;
+ server)
+ package=./cmd/pulse
+ ldflags="${server_ldflags}"
+ ;;
+ esac
+ read -r -a target_env_parts <<<"${target_env}"
+ command=(go build "${release_go_build_args[@]}")
+ if [[ "${component}" == server ]]; then command+=(-tags release); fi
+ if [[ -n "${ldflags}" ]]; then command+=("-ldflags=${ldflags}"); fi
+ command+=(-o "${output}" "${package}")
+ env "${target_env_parts[@]}" GOMAXPROCS="${go_procs}" "${command[@]}"
+}
+
+declare -a active_pids=()
+declare -A task_by_pid=()
+terminate_tree() {
+ local parent_pid="$1"
+ local child_pid
+ while IFS= read -r child_pid; do
+ [[ -n "${child_pid}" ]] && terminate_tree "${child_pid}"
+ done < <(pgrep -P "${parent_pid}" || true)
+ kill -TERM "${parent_pid}" >/dev/null 2>&1 || true
+}
+terminate_active() {
+ local pid
+ for pid in "${active_pids[@]:-}"; do
+ [[ -n "${pid}" ]] && terminate_tree "${pid}"
+ done
+ wait "${active_pids[@]:-}" >/dev/null 2>&1 || true
+}
+trap terminate_active INT TERM
+
+next_task=0
+completed_tasks=0
+total_tasks="${#task_components[@]}"
+while (( completed_tasks < total_tasks )); do
+ while (( next_task < total_tasks && ${#active_pids[@]} < build_jobs )); do
+ component="${task_components[next_task]}"
+ target="${task_targets[next_task]}"
+ log_path="${OUTPUT_ROOT}/${component}-${target}.log"
+ build_one "${component}" "${target}" >"${log_path}" 2>&1 &
+ pid=$!
+ active_pids+=("${pid}")
+ task_by_pid["${pid}"]="${component}-${target}:${log_path}"
+ next_task=$((next_task + 1))
+ done
+
+ completed_pid=""
+ if wait -n -p completed_pid; then
+ status=0
+ else
+ status=$?
+ fi
+ task_record="${task_by_pid[${completed_pid}]:-unknown:}"
+ task_name="${task_record%%:*}"
+ log_path="${task_record#*:}"
+ remaining_pids=()
+ for pid in "${active_pids[@]}"; do
+ if [[ "${pid}" != "${completed_pid}" ]]; then remaining_pids+=("${pid}"); fi
+ done
+ active_pids=("${remaining_pids[@]}")
+ unset "task_by_pid[${completed_pid}]"
+ if (( status != 0 )); then
+ echo "Error: release compilation task failed: ${task_name}" >&2
+ [[ -f "${log_path}" ]] && cat "${log_path}" >&2
+ terminate_active
+ exit "${status}"
+ fi
+ rm -f "${log_path}"
+ completed_tasks=$((completed_tasks + 1))
+ echo "Compiled ${task_name} (${completed_tasks}/${total_tasks})."
+done
+trap - INT TERM
+
+python3 scripts/release_candidate_manifest.py create \
+ --release-dir "${PAYLOAD_DIR}" \
+ --version "${VERSION}" \
+ --source-sha "${SOURCE_SHA}" \
+ --output "${MANIFEST_DIR}/release-compiled.json"
+
+echo "Credential-free release compilation complete: ${OUTPUT_ROOT}"
diff --git a/scripts/build-release.sh b/scripts/build-release.sh
index c25556377b..de90a89831 100755
--- a/scripts/build-release.sh
+++ b/scripts/build-release.sh
@@ -11,6 +11,7 @@ PULSE_REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
cd "${PULSE_REPO_ROOT}"
source "${SCRIPT_DIR}/release_asset_common.sh"
+source "${SCRIPT_DIR}/release_build_targets.sh"
# Prefer the pinned toolchain from go.mod (toolchain directive).
# If /usr/local/go exists (typical in CI images), prepend it to PATH.
@@ -102,50 +103,47 @@ rm -rf $BUILD_DIR $RELEASE_DIR
mkdir -p $BUILD_DIR $RELEASE_DIR
render_release_installers "${RENDERED_INSTALLERS_DIR}"
-# Build frontend
-echo "Building frontend..."
-npm --prefix frontend-modern ci
-npm --prefix frontend-modern run build
+# Build the frontend locally, or consume the exact-SHA payload produced by the
+# credential-free compilation lane.
+if [[ -n "${PULSE_RELEASE_COMPILED_PAYLOAD_DIR:-}" ]]; then
+ compiled_payload_dir="$(cd "${PULSE_RELEASE_COMPILED_PAYLOAD_DIR}" && pwd)"
+ test -d "${compiled_payload_dir}/frontend-dist" || {
+ echo "Error: compiled release payload is missing frontend-dist." >&2
+ exit 1
+ }
+ rm -rf frontend-modern/dist
+ mkdir -p frontend-modern/dist
+ cp -a "${compiled_payload_dir}/frontend-dist/." frontend-modern/dist/
+ echo "Applied exact-SHA precompiled frontend bundle."
+else
+ echo "Building frontend..."
+ npm --prefix frontend-modern ci
+ npm --prefix frontend-modern run build
+fi
agent_ldflags="$(./scripts/release_ldflags.sh agent --version "v${VERSION}" "${update_ldflags_args[@]}")"
# Build unified agents for every supported platform/architecture
echo "Building unified agents for all platforms..."
-agent_build_order=(linux-amd64 linux-arm64 linux-armv7 linux-armv6 linux-386 darwin-amd64 darwin-arm64 freebsd-amd64 freebsd-arm64 windows-amd64 windows-arm64 windows-386)
-agent_build_envs=(
- "GOOS=linux GOARCH=amd64"
- "GOOS=linux GOARCH=arm64"
- "GOOS=linux GOARCH=arm GOARM=7"
- "GOOS=linux GOARCH=arm GOARM=6"
- "GOOS=linux GOARCH=386"
- "GOOS=darwin GOARCH=amd64"
- "GOOS=darwin GOARCH=arm64"
- "GOOS=freebsd GOARCH=amd64"
- "GOOS=freebsd GOARCH=arm64"
- "GOOS=windows GOARCH=amd64"
- "GOOS=windows GOARCH=arm64"
- "GOOS=windows GOARCH=386"
-)
-
-if [[ ${#agent_build_order[@]} -ne ${#agent_build_envs[@]} ]]; then
- echo "Unified agent build config mismatch." >&2
- exit 1
-fi
-
-for i in "${!agent_build_order[@]}"; do
- target="${agent_build_order[$i]}"
- build_env="${agent_build_envs[$i]}"
- output_path="$BUILD_DIR/pulse-agent-$target"
- if [[ "$target" == windows-* ]]; then
- output_path="${output_path}.exe"
- fi
+agent_build_order=("${PULSE_RELEASE_AGENT_TARGETS[@]}")
- env $build_env go build \
- -ldflags="${agent_ldflags}" \
- "${release_go_build_args[@]}" \
- -o "$output_path" \
- ./cmd/pulse-agent
-done
+if [[ -n "${compiled_payload_dir:-}" ]]; then
+ test -d "${compiled_payload_dir}/binaries" || {
+ echo "Error: compiled release payload is missing binaries." >&2
+ exit 1
+ }
+ cp -a "${compiled_payload_dir}/binaries/." "${BUILD_DIR}/"
+else
+ for target in "${agent_build_order[@]}"; do
+ build_env="$(pulse_release_target_env "${target}")"
+ output_path="${BUILD_DIR}/$(pulse_release_binary_filename agent "${target}")"
+ env ${build_env} go build \
+ -ldflags="${agent_ldflags}" \
+ "${release_go_build_args[@]}" \
+ -o "${output_path}" \
+ ./cmd/pulse-agent
+ done
+fi
# Platform-native signing jobs may supply replacement desktop binaries. They
# are copied before packaging, checksums, SBOM generation, and release signing
@@ -186,58 +184,58 @@ fi
# it points at, so its own build identity is intentionally minimal.
echo "Building pulse-mcp for all platforms..."
mcp_build_order=("${agent_build_order[@]}")
-mcp_build_envs=("${agent_build_envs[@]}")
-
-for i in "${!mcp_build_order[@]}"; do
- target="${mcp_build_order[$i]}"
- build_env="${mcp_build_envs[$i]}"
- output_path="$BUILD_DIR/pulse-mcp-$target"
- if [[ "$target" == windows-* ]]; then
- output_path="${output_path}.exe"
- fi
- env $build_env go build \
- "${release_go_build_args[@]}" \
- -o "$output_path" \
- ./cmd/pulse-mcp
-done
+if [[ -z "${compiled_payload_dir:-}" ]]; then
+ for target in "${mcp_build_order[@]}"; do
+ build_env="$(pulse_release_target_env "${target}")"
+ output_path="${BUILD_DIR}/$(pulse_release_binary_filename mcp "${target}")"
+ env ${build_env} go build \
+ "${release_go_build_args[@]}" \
+ -o "${output_path}" \
+ ./cmd/pulse-mcp
+ done
+fi
# Build for different architectures (server + agents)
-build_order=(linux-amd64 linux-arm64 linux-armv7 linux-armv6 linux-386)
-build_envs=(
- "GOOS=linux GOARCH=amd64"
- "GOOS=linux GOARCH=arm64"
- "GOOS=linux GOARCH=arm GOARM=7"
- "GOOS=linux GOARCH=arm GOARM=6"
- "GOOS=linux GOARCH=386"
-)
-
-if [[ ${#build_order[@]} -ne ${#build_envs[@]} ]]; then
- echo "Build target config mismatch." >&2
- exit 1
+build_order=("${PULSE_RELEASE_SERVER_TARGETS[@]}")
+
+if [[ -z "${compiled_payload_dir:-}" ]]; then
+ for build_name in "${build_order[@]}"; do
+ echo "Building for $build_name..."
+
+ build_env="$(pulse_release_target_env "${build_name}")"
+
+ build_time=$(date -u '+%Y-%m-%d_%H:%M:%S')
+ git_commit=$(git rev-parse --short HEAD 2>/dev/null || echo 'unknown')
+
+ server_ldflags="$(./scripts/release_ldflags.sh server --version "v${VERSION}" --build-time "${build_time}" --git-commit "${git_commit}" "${license_ldflags_args[@]}" "${update_ldflags_args[@]}")"
+
+ # Build backend binary with version info. The release tag disables
+ # development-only feature-gating and signature-validation bypasses.
+ env $build_env go build \
+ -tags release \
+ -ldflags="${server_ldflags}" \
+ "${release_go_build_args[@]}" \
+ -o "$BUILD_DIR/pulse-$build_name" \
+ ./cmd/pulse
+ done
fi
-for i in "${!build_order[@]}"; do
- build_name="${build_order[$i]}"
- echo "Building for $build_name..."
-
- build_env="${build_envs[$i]}"
-
- build_time=$(date -u '+%Y-%m-%d_%H:%M:%S')
- git_commit=$(git rev-parse --short HEAD 2>/dev/null || echo 'unknown')
-
- server_ldflags="$(./scripts/release_ldflags.sh server --version "v${VERSION}" --build-time "${build_time}" --git-commit "${git_commit}" "${license_ldflags_args[@]}" "${update_ldflags_args[@]}")"
-
- # Build backend binary with version info
- # -tags release disables dev-mode env-var bypasses (PULSE_DEV, PULSE_MOCK_MODE,
- # PULSE_LICENSE_DEV_MODE) so they cannot be used to skip feature gating or
- # license signature validation in production binaries.
- env $build_env go build \
- -tags release \
- -ldflags="${server_ldflags}" \
- "${release_go_build_args[@]}" \
- -o "$BUILD_DIR/pulse-$build_name" \
- ./cmd/pulse
+for target in "${agent_build_order[@]}"; do
+ test -f "${BUILD_DIR}/$(pulse_release_binary_filename agent "${target}")" || {
+ echo "Error: release payload is missing agent binary for ${target}." >&2
+ exit 1
+ }
+ test -f "${BUILD_DIR}/$(pulse_release_binary_filename mcp "${target}")" || {
+ echo "Error: release payload is missing MCP binary for ${target}." >&2
+ exit 1
+ }
+done
+for target in "${build_order[@]}"; do
+ test -f "${BUILD_DIR}/$(pulse_release_binary_filename server "${target}")" || {
+ echo "Error: release payload is missing server binary for ${target}." >&2
+ exit 1
+ }
done
# Create platform-specific tarballs that include all unified agent binaries for download endpoints
diff --git a/scripts/installtests/build_release_assets_test.go b/scripts/installtests/build_release_assets_test.go
index 8e293607d8..c86779a921 100644
--- a/scripts/installtests/build_release_assets_test.go
+++ b/scripts/installtests/build_release_assets_test.go
@@ -22,6 +22,11 @@ func TestBuildReleaseUsesV6InstallScripts(t *testing.T) {
}
script := string(content)
+ compileContent, err := os.ReadFile(repoFile("scripts", "build-release-binaries.sh"))
+ if err != nil {
+ t.Fatalf("read build-release-binaries.sh: %v", err)
+ }
+ compileScript := string(compileContent)
required := []string{
`SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"`,
`PULSE_REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"`,
@@ -80,9 +85,17 @@ func TestBuildReleaseUsesV6InstallScripts(t *testing.T) {
t.Fatalf("build-release.sh missing canonical ldflags wiring: %s", needle)
}
}
- if builds, cleanBuilds := strings.Count(script, `env $build_env go build \`), strings.Count(script, `"${release_go_build_args[@]}"`); builds != cleanBuilds {
+ if builds, cleanBuilds := strings.Count(script, "go build \\\n"), strings.Count(script, `"${release_go_build_args[@]}"`); builds != cleanBuilds {
t.Fatalf("build-release.sh must disable automatic VCS stamping on every release go build: builds=%d clean_builds=%d", builds, cleanBuilds)
}
+ for _, needle := range []string{
+ `release_go_build_args=(-buildvcs=false -trimpath)`,
+ `command=(go build "${release_go_build_args[@]}")`,
+ } {
+ if !strings.Contains(compileScript, needle) {
+ t.Fatalf("build-release-binaries.sh missing clean compilation contract: %s", needle)
+ }
+ }
helperBytes, err := os.ReadFile(repoFile("scripts", "release_asset_common.sh"))
if err != nil {
@@ -1764,11 +1777,13 @@ func TestBuildReleasePackagesPulseMcpForAllPlatforms(t *testing.T) {
t.Fatalf("read build-release.sh: %v", err)
}
script := string(content)
+ compileContent, err := os.ReadFile(repoFile("scripts", "build-release-binaries.sh"))
+ if err != nil {
+ t.Fatalf("read build-release-binaries.sh: %v", err)
+ }
+ compileScript := string(compileContent)
required := []string{
- // Build loop wires through ./cmd/pulse-mcp.
- `-o "$output_path" \
- ./cmd/pulse-mcp`,
// Per-platform packaging follows the pulse-agent shape
// exactly so the upload step's glob does not need
// special cases.
@@ -1793,6 +1808,14 @@ func TestBuildReleasePackagesPulseMcpForAllPlatforms(t *testing.T) {
t.Fatalf("build-release.sh missing pulse-mcp distribution wiring: %s", needle)
}
}
+ for _, needle := range []string{
+ `package=./cmd/pulse-mcp`,
+ `pulse_release_binary_filename "${component}" "${target}"`,
+ } {
+ if !strings.Contains(compileScript, needle) {
+ t.Fatalf("build-release-binaries.sh missing pulse-mcp compilation wiring: %s", needle)
+ }
+ }
// install-mcp.sh and install-mcp.ps1 must both exist as
// shipped scripts; the build pipeline references them, so
@@ -2001,6 +2024,11 @@ func TestReleasePipelinePromotesOneImmutableCandidate(t *testing.T) {
createWorkflow := string(createBytes)
candidateWorkflow := string(candidateBytes)
+ compileScriptBytes, err := os.ReadFile(repoFile("scripts", "build-release-binaries.sh"))
+ if err != nil {
+ t.Fatalf("read build-release-binaries.sh: %v", err)
+ }
+ compileScript := string(compileScriptBytes)
validationWorkflow := string(validationBytes)
convergenceWorkflow := string(convergenceBytes)
recoveryWorkflow := string(recoveryBytes)
@@ -2018,6 +2046,39 @@ func TestReleasePipelinePromotesOneImmutableCandidate(t *testing.T) {
floatingJob := workflowJobBlock(t, convergenceWorkflow, "promote_floating_tags")
helmPagesJob := workflowJobBlock(t, convergenceWorkflow, "publish_helm_pages")
demoJob := workflowJobBlock(t, convergenceWorkflow, "update_stable_demo")
+ compileJob := workflowJobBlock(t, candidateWorkflow, "compile-release-payload")
+ candidateBuildJob := workflowJobBlock(t, candidateWorkflow, "build")
+
+ for _, needle := range []string{
+ "pulse-pve-compile",
+ `./scripts/build-release-binaries.sh "${{ inputs.version }}"`,
+ `release-compiled-${{ github.sha }}-${{ inputs.version }}`,
+ } {
+ if !strings.Contains(compileJob, needle) {
+ t.Fatalf("compiled release payload job missing exact-SHA contract: %s", needle)
+ }
+ }
+ if strings.Contains(compileJob, "PULSE_UPDATE_SIGNING_KEY") {
+ t.Fatal("PVE release compilation job must not receive private update-signing material")
+ }
+ for _, needle := range []string{
+ `scripts/release_candidate_manifest.py create`,
+ `--source-sha "${SOURCE_SHA}"`,
+ `--release-dir "${PAYLOAD_DIR}"`,
+ } {
+ if !strings.Contains(compileScript, needle) {
+ t.Fatalf("compiled release payload script missing manifest binding: %s", needle)
+ }
+ }
+ for _, needle := range []string{
+ `needs.compile-release-payload.result == 'success'`,
+ `scripts/release_candidate_manifest.py verify-local`,
+ `PULSE_RELEASE_COMPILED_PAYLOAD_DIR`,
+ } {
+ if !strings.Contains(candidateBuildJob, needle) {
+ t.Fatalf("hosted candidate build missing compiled-payload verification: %s", needle)
+ }
+ }
for _, needle := range []string{
`./scripts/build-release.sh "${{ inputs.version }}"`,
diff --git a/scripts/release_build_targets.sh b/scripts/release_build_targets.sh
new file mode 100755
index 0000000000..c7853034db
--- /dev/null
+++ b/scripts/release_build_targets.sh
@@ -0,0 +1,68 @@
+#!/usr/bin/env bash
+
+# Canonical cross-compilation target matrices shared by release compilation and
+# packaging. Keep target names aligned with published asset names.
+
+PULSE_RELEASE_AGENT_TARGETS=(
+ linux-amd64
+ linux-arm64
+ linux-armv7
+ linux-armv6
+ linux-386
+ darwin-amd64
+ darwin-arm64
+ freebsd-amd64
+ freebsd-arm64
+ windows-amd64
+ windows-arm64
+ windows-386
+)
+
+PULSE_RELEASE_SERVER_TARGETS=(
+ linux-amd64
+ linux-arm64
+ linux-armv7
+ linux-armv6
+ linux-386
+)
+
+pulse_release_target_env() {
+ case "$1" in
+ linux-amd64) printf '%s\n' 'GOOS=linux GOARCH=amd64' ;;
+ linux-arm64) printf '%s\n' 'GOOS=linux GOARCH=arm64' ;;
+ linux-armv7) printf '%s\n' 'GOOS=linux GOARCH=arm GOARM=7' ;;
+ linux-armv6) printf '%s\n' 'GOOS=linux GOARCH=arm GOARM=6' ;;
+ linux-386) printf '%s\n' 'GOOS=linux GOARCH=386' ;;
+ darwin-amd64) printf '%s\n' 'GOOS=darwin GOARCH=amd64' ;;
+ darwin-arm64) printf '%s\n' 'GOOS=darwin GOARCH=arm64' ;;
+ freebsd-amd64) printf '%s\n' 'GOOS=freebsd GOARCH=amd64' ;;
+ freebsd-arm64) printf '%s\n' 'GOOS=freebsd GOARCH=arm64' ;;
+ windows-amd64) printf '%s\n' 'GOOS=windows GOARCH=amd64' ;;
+ windows-arm64) printf '%s\n' 'GOOS=windows GOARCH=arm64' ;;
+ windows-386) printf '%s\n' 'GOOS=windows GOARCH=386' ;;
+ *)
+ echo "Error: unsupported release target: $1" >&2
+ return 1
+ ;;
+ esac
+}
+
+pulse_release_binary_filename() {
+ local component="$1"
+ local target="$2"
+ local filename
+
+ case "${component}" in
+ agent) filename="pulse-agent-${target}" ;;
+ mcp) filename="pulse-mcp-${target}" ;;
+ server) filename="pulse-${target}" ;;
+ *)
+ echo "Error: unsupported release component: ${component}" >&2
+ return 1
+ ;;
+ esac
+ if [[ "${target}" == windows-* ]]; then
+ filename="${filename}.exe"
+ fi
+ printf '%s\n' "${filename}"
+}