Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 11 additions & 18 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand All @@ -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
Expand Down
12 changes: 8 additions & 4 deletions Dockerfile.build-deb
Original file line number Diff line number Diff line change
Expand Up @@ -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 / /
12 changes: 2 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand All @@ -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 <devops+ci@flashbots.net>" \
--section network $(CARGO_DEB_ARGS)

##@ Dev

.PHONY: lint
Expand Down
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,27 +123,31 @@ 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
with the required native libraries, run `make build-attestation-provider FEATURES=azure`
(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~<version>` 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~<version>` 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.
Expand Down
18 changes: 18 additions & 0 deletions crates/attested-tls-proxy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ maintainer = "Flashbots Team <devops+ci@flashbots.net>"
depends = "$auto"
section = "network"
priority = "optional"
provides = "attestation-provider-server"
conflicts = "attestation-provider-server"
replaces = "attestation-provider-server"
maintainer-scripts = "../../pkg/debian"
assets = [
[
Expand All @@ -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" }
7 changes: 0 additions & 7 deletions pkg/attestation-provider-server/deb.toml

This file was deleted.

5 changes: 3 additions & 2 deletions scripts/check-reproducibility.sh
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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" \
Expand All @@ -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
Expand Down
18 changes: 7 additions & 11 deletions scripts/prepare-attestation-provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Loading