From 6db3f3b7b43e546568348f54c2800eb6bf2412fa Mon Sep 17 00:00:00 2001 From: peg Date: Wed, 25 Nov 2026 10:11:59 +0100 Subject: [PATCH] Release workflow gives a single debian package with both proxy and quote provider --- .github/workflows/release.yaml | 29 +++++++++-------------- Dockerfile.build-deb | 12 ++++++---- Makefile | 12 ++-------- README.md | 30 ++++++++++++++---------- crates/attested-tls-proxy/Cargo.toml | 18 ++++++++++++++ pkg/attestation-provider-server/deb.toml | 7 ------ scripts/check-reproducibility.sh | 5 ++-- scripts/prepare-attestation-provider.py | 18 ++++++-------- 8 files changed, 66 insertions(+), 65 deletions(-) delete mode 100644 pkg/attestation-provider-server/deb.toml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f55f715..c84b3e0 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -120,20 +120,13 @@ jobs: path: target/${{ matrix.configs.profile }}/attestation-provider-server if-no-files-found: error - - name: Upload proxy Debian package + - name: Upload combined Debian package uses: actions/upload-artifact@v4 with: name: deb-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }}${{ matrix.features && '-' }}${{ matrix.features }} path: target/debian/attested-tls-proxy_*.deb if-no-files-found: error - - name: Upload provider Debian package - uses: actions/upload-artifact@v4 - with: - name: attestation-provider-server-deb-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }}${{ matrix.features && '-' }}${{ matrix.features }} - path: target/debian/attestation-provider-server_*.deb - if-no-files-found: error - draft-release: name: Draft release @@ -155,7 +148,7 @@ jobs: name: attested-tls-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu-${{ env.BUILD_FEATURES }} path: artifacts - - name: Download proxy Debian package artifact + - name: Download combined Debian package artifact uses: actions/download-artifact@v5 with: name: deb-${{ env.VERSION }}-x86_64-unknown-linux-gnu-${{ env.BUILD_FEATURES }} @@ -167,18 +160,18 @@ jobs: name: attestation-provider-server-${{ env.VERSION }}-x86_64-unknown-linux-gnu-${{ env.BUILD_FEATURES }} path: artifacts - - name: Download provider Debian package artifact - uses: actions/download-artifact@v5 - with: - name: attestation-provider-server-deb-${{ env.VERSION }}-x86_64-unknown-linux-gnu-${{ env.BUILD_FEATURES }} - path: artifacts - - name: Record artifacts checksums working-directory: artifacts run: | - sha256sum attested-tls-proxy attested-tls-proxy_*.deb > sha256sums.txt - sha256sum attestation-provider-server attestation-provider-server_*.deb > attestation-provider-server-sha256sums.txt - cat sha256sums.txt attestation-provider-server-sha256sums.txt + # Match the asset filename GitHub publishes before recording checksums. + for package in attested-tls-proxy_*.deb; do + release_name="${package//[~]/.}" + if [ "$release_name" != "$package" ]; then + mv -- "$package" "$release_name" + fi + done + sha256sum attested-tls-proxy attestation-provider-server attested-tls-proxy_*.deb > sha256sums.txt + cat sha256sums.txt - name: Create release draft uses: softprops/action-gh-release@v2.0.5 diff --git a/Dockerfile.build-deb b/Dockerfile.build-deb index b9a794d..d7c5866 100644 --- a/Dockerfile.build-deb +++ b/Dockerfile.build-deb @@ -17,16 +17,20 @@ WORKDIR /build COPY . . FROM builder AS proxy-builder -RUN make build && make build-deb +RUN make build FROM builder AS provider-builder -RUN make build-attestation-provider && make build-attestation-provider-deb +RUN make build-attestation-provider + +FROM proxy-builder AS package-builder +COPY --from=provider-builder /build/target/x86_64-unknown-linux-gnu/reproducible/attestation-provider-server /build/target/x86_64-unknown-linux-gnu/reproducible/attestation-provider-server +COPY --from=provider-builder /build/target/x86_64-unknown-linux-gnu/reproducible/attestation-provider-docs/ /build/target/x86_64-unknown-linux-gnu/reproducible/attestation-provider-docs/ +RUN make build-deb FROM scratch AS provider-artifacts COPY --from=provider-builder /build/target/x86_64-unknown-linux-gnu/reproducible/attestation-provider-server /reproducible/attestation-provider-server -COPY --from=provider-builder /build/target/debian/ /debian/ FROM scratch AS artifacts COPY --from=proxy-builder /build/target/x86_64-unknown-linux-gnu/reproducible/attested-tls-proxy /reproducible/attested-tls-proxy -COPY --from=proxy-builder /build/target/debian/ /debian/ +COPY --from=package-builder /build/target/debian/attested-tls-proxy_*.deb /debian/ COPY --from=provider-artifacts / / diff --git a/Makefile b/Makefile index 1eb306a..8bda3b5 100644 --- a/Makefile +++ b/Makefile @@ -85,7 +85,7 @@ build: install-cargo-auditable ## Build (release version) .PHONY: build-attestation-provider build-attestation-provider: install-cargo-auditable ## Build the provider from the pinned upstream revision - provider_source=$$(python3 scripts/prepare-attestation-provider.py --profile "$(BUILD_PROFILE)") && \ + provider_source=$$(python3 scripts/prepare-attestation-provider.py --target "$(BUILD_TARGET)" --profile "$(BUILD_PROFILE)") && \ $(BUILD_ENV) cargo auditable build -p attestation-provider-server \ --manifest-path "$$provider_source/Cargo.toml" --target-dir "$(CURDIR)/target" \ --config "$(CURDIR)/target/attestation-provider-profile.toml" \ @@ -106,17 +106,9 @@ CARGO_DEB_ARGS = --profile $(BUILD_PROFILE) --no-build --no-dbgsym --no-strip \ $(if $(VERSION),--deb-version "1~$(VERSION)") .PHONY: build-deb -build-deb: install-cargo-deb ## Build Debian package +build-deb: install-cargo-deb ## Package both previously built binaries $(BUILD_ENV) cargo deb -p attested-tls-proxy $(CARGO_DEB_ARGS) -.PHONY: build-attestation-provider-deb -build-attestation-provider-deb: install-cargo-deb ## Package the previously built provider binary - provider_source=$$(python3 scripts/prepare-attestation-provider.py --profile "$(BUILD_PROFILE)" --deb) && \ - $(BUILD_ENV) CARGO_TARGET_DIR="$(CURDIR)/target" cargo deb \ - --manifest-path "$$provider_source/crates/attestation-provider-server/Cargo.toml" \ - -p attestation-provider-server --maintainer "Flashbots Team " \ - --section network $(CARGO_DEB_ARGS) - ##@ Dev .PHONY: lint diff --git a/README.md b/README.md index 121883b..5aa1fac 100644 --- a/README.md +++ b/README.md @@ -123,13 +123,13 @@ for the directory ownership and permissions required by the service. This option replaces `--dev-dummy-dcap`; migrate existing HTTP provider URLs to the Unix socket service. -GitHub releases include standalone binaries and Debian packages for both -`attested-tls-proxy` and `attestation-provider-server`. `sha256sums.txt` covers the -proxy binary and package; `attestation-provider-server-sha256sums.txt` covers the -provider binary and package. The provider is built from the exact upstream +GitHub releases include standalone `attested-tls-proxy` and +`attestation-provider-server` binaries and one `attested-tls-proxy` Debian package +containing both binaries. `sha256sums.txt` covers both binaries and the package. +The provider is built from the exact upstream revision pinned by the `attestation` dependency, using upstream's `Cargo.lock`. -It includes Azure quote generation in -the release build and reports its upstream Git revision with `--version`. +It includes Azure quote generation in the release build and reports its upstream +Git revision with `--version`. Both binaries use the same Docker builder, Rust toolchain, reproducible profile, build flags, and commit timestamp. To build the provider locally in an environment @@ -137,13 +137,17 @@ with the required native libraries, run `make build-attestation-provider FEATURE (Python 3.11 or newer is required for checkout and profile preparation). Make invokes Cargo directly for both binaries. To rebuild twice and compare artifact hashes, run `scripts/check-reproducibility.sh`; pass `provider-artifacts` to check only -the provider binary and Debian package. Both packages use the same pinned -cargo-deb version and commit timestamp, and preserve the compiled binary without -rebuilding or stripping it. After building the provider locally, run -`make build-attestation-provider-deb` to package it; set `VERSION` to use the same -`1~` package version as a release. The package installs the provider at -`/usr/bin/attestation-provider-server` and declares its native library dependencies. -It also includes the full license from the pinned upstream revision. +the provider binary. To build the combined package locally, run +`make build build-attestation-provider FEATURES=azure` followed by `make build-deb`; +set `VERSION` to use the same `1~` package version as a release. +Packaging uses the pinned cargo-deb version and commit timestamp and preserves +both compiled binaries without rebuilding or stripping them. The package installs +both binaries in `/usr/bin`, declares their native library dependencies, and +includes the provider's full upstream license and documentation under +`/usr/share/doc/attested-tls-proxy/attestation-provider-server/`. +It replaces the former standalone `attestation-provider-server` package on upgrade. +The proxy and provider continue to run as separate processes with independently +configured permissions. `RUST_TOOLCHAIN`, `RUST_IMAGE`, `FEATURES`, `SOURCE_DATE`, and `VERSION` can be set to reproduce a particular release's build inputs. The release workflow records the Rust version, immutable builder image digest, and timestamp in its job summary. diff --git a/crates/attested-tls-proxy/Cargo.toml b/crates/attested-tls-proxy/Cargo.toml index c04cdc3..d443560 100644 --- a/crates/attested-tls-proxy/Cargo.toml +++ b/crates/attested-tls-proxy/Cargo.toml @@ -55,6 +55,9 @@ maintainer = "Flashbots Team " depends = "$auto" section = "network" priority = "optional" +provides = "attestation-provider-server" +conflicts = "attestation-provider-server" +replaces = "attestation-provider-server" maintainer-scripts = "../../pkg/debian" assets = [ [ @@ -63,10 +66,25 @@ assets = [ "usr/bin/", "755", ], + [ + "target/release/attestation-provider-server", + "usr/bin/", + "755", + ], [ "../../LICENSE", "usr/share/doc/attested-tls-proxy/", "644", ], + [ + "target/release/attestation-provider-docs/LICENSE", + "usr/share/doc/attested-tls-proxy/attestation-provider-server/LICENSE", + "644", + ], + [ + "target/release/attestation-provider-docs/README.md", + "usr/share/doc/attested-tls-proxy/attestation-provider-server/README.md", + "644", + ], ] systemd-units = { enable = false, start = false, unit-name = "attested-tls-proxy" } diff --git a/pkg/attestation-provider-server/deb.toml b/pkg/attestation-provider-server/deb.toml deleted file mode 100644 index 2871004..0000000 --- a/pkg/attestation-provider-server/deb.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package.metadata.deb] -license-file = "../../LICENSE" -assets = [ - ["target/release/attestation-provider-server", "usr/bin/", "755"], - ["README.md", "usr/share/doc/attestation-provider-server/", "644"], - ["../../LICENSE", "usr/share/doc/attestation-provider-server/", "644"], -] diff --git a/scripts/check-reproducibility.sh b/scripts/check-reproducibility.sh index b843578..0f76521 100755 --- a/scripts/check-reproducibility.sh +++ b/scripts/check-reproducibility.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Build release artifacts twice and require matching hashes. Pass -# provider-artifacts to check only the provider binary and Debian package. +# provider-artifacts to check only the standalone provider binary. set -euo pipefail @@ -18,6 +18,7 @@ for build in 1 2; do # Reuse the identical native toolchain while forcing fresh Cargo builds. docker build -f Dockerfile.build-deb \ --no-cache-filter proxy-builder --no-cache-filter provider-builder \ + --no-cache-filter package-builder \ --target "$build_stage" \ --build-arg "RUST_TOOLCHAIN=$rust_toolchain" \ --build-arg "RUST_IMAGE=$rust_image" \ @@ -28,7 +29,7 @@ for build in 1 2; do ( cd "$repro_dir/$build" - sha256sum reproducible/attestation-provider-server debian/attestation-provider-server_*.deb + sha256sum reproducible/attestation-provider-server if [ "$build_stage" = artifacts ]; then sha256sum reproducible/attested-tls-proxy debian/attested-tls-proxy_*.deb fi diff --git a/scripts/prepare-attestation-provider.py b/scripts/prepare-attestation-provider.py index 404dcb8..67232d2 100644 --- a/scripts/prepare-attestation-provider.py +++ b/scripts/prepare-attestation-provider.py @@ -17,8 +17,8 @@ def run(*args, cwd): def main(): parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--target", default="") parser.add_argument("--profile", default="reproducible") - parser.add_argument("--deb", action="store_true", help="prepare a source copy with Debian packaging metadata") args = parser.parse_args() root = Path(__file__).resolve().parent.parent @@ -61,16 +61,12 @@ def main(): + "".join(f"{json.dumps(key)} = {json.dumps(value)}\n" for key, value in profile.items()) ) - if args.deb: - # Add release packaging metadata outside the original checkout so it - # stays clean for subsequent builds. Recopying restores the original - # manifest before adding the metadata on repeated packaging runs. - packaging_source = root / "target/attestation-provider-deb-src" / revision - shutil.copytree(source, packaging_source, dirs_exist_ok=True, ignore=shutil.ignore_patterns(".git", "target")) - packaging_manifest = packaging_source / "crates/attestation-provider-server/Cargo.toml" - with packaging_manifest.open("a") as file: - file.write("\n" + (root / "pkg/attestation-provider-server/deb.toml").read_text()) - source = packaging_source + # Stage the pinned provider's documentation for the combined Debian package. + profile_directory = "debug" if args.profile == "dev" else args.profile + documentation = root / "target" / args.target / profile_directory / "attestation-provider-docs" + documentation.mkdir(parents=True, exist_ok=True) + shutil.copyfile(source / "LICENSE", documentation / "LICENSE") + shutil.copyfile(source / "crates/attestation-provider-server/README.md", documentation / "README.md") print(f"Prepared attestation-provider-server from {dependency['git']} at {revision}", file=sys.stderr) print(source)