-
Notifications
You must be signed in to change notification settings - Fork 890
feat: Add reproducible Debian package builds and distribution #7617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
MoeMahhouk
wants to merge
8
commits into
sigp:unstable
Choose a base branch
from
MoeMahhouk:deb-packaging
base: unstable
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9a2d6da
chore: refactor reproducible builds
MoeMahhouk 10a3b59
Add release-reproducible CI workflow
MoeMahhouk a4348b2
Add reproducible-build workflow to catch regressions
MoeMahhouk 608caab
fixing linting issues
MoeMahhouk b946c49
Add necessary setup for reproducible debian packaging
MoeMahhouk d58a9c1
add CI workflow to build and upload deb packages as assets
MoeMahhouk af4c59b
merge the deb packaging workflow into release.yml to avoid conflicts
MoeMahhouk 211063a
refinements and following packaging best practices
MoeMahhouk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
name: release-reproducible | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
workflow_dispatch: | ||
inputs: | ||
dry_run: | ||
description: >- | ||
Enable dry run mode (builds images but skips push to registry) | ||
type: boolean | ||
default: false | ||
|
||
env: | ||
DOCKER_REPRODUCIBLE_IMAGE_NAME: >- | ||
${{ github.repository_owner }}/lighthouse-reproducible | ||
DOCKER_PASSWORD: ${{ secrets.DH_KEY }} | ||
DOCKER_USERNAME: ${{ secrets.DH_ORG }} | ||
|
||
jobs: | ||
extract-version: | ||
name: extract version | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Extract version | ||
run: >- | ||
echo "VERSION=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT | ||
id: extract_version | ||
outputs: | ||
VERSION: ${{ steps.extract_version.outputs.VERSION }} | ||
|
||
build-reproducible: | ||
name: build and push reproducible images | ||
runs-on: ubuntu-latest | ||
needs: extract-version | ||
strategy: | ||
matrix: | ||
arch: [amd64, arm64] | ||
include: | ||
- arch: amd64 | ||
rust_target: x86_64-unknown-linux-gnu | ||
rust_image: >- | ||
rust:1.86-bullseye@sha256:1110399f568f1dbe838e58f15b4162d899cb95f450f5f0ffa739614f3a4c32f1 | ||
platform: linux/amd64 | ||
- arch: arm64 | ||
rust_target: aarch64-unknown-linux-gnu | ||
rust_image: >- | ||
rust:1.86-bullseye@sha256:36053eabadeb701e3e0406610a2ce72ccfa10b7828963cd08cffdcf660518b27 | ||
platform: linux/arm64 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to Docker Hub | ||
if: ${{ github.event.inputs.dry_run != 'true' }} | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ env.DOCKER_USERNAME }} | ||
password: ${{ env.DOCKER_PASSWORD }} | ||
|
||
- name: Build reproducible image (${{ matrix.arch }}) | ||
uses: docker/build-push-action@v6 | ||
env: | ||
IMAGE_BASE: ${{ env.DOCKER_REPRODUCIBLE_IMAGE_NAME }} | ||
VERSION: ${{ needs.extract-version.outputs.VERSION }} | ||
ARCH: ${{ matrix.arch }} | ||
DOCKER_BUILD_RECORD_UPLOAD: false | ||
with: | ||
context: . | ||
file: ./Dockerfile.reproducible | ||
platforms: ${{ matrix.platform }} | ||
push: ${{ github.event.inputs.dry_run != 'true' }} | ||
tags: ${{ env.IMAGE_BASE }}:${{ env.VERSION }}-${{ env.ARCH }} | ||
build-args: | | ||
RUST_TARGET=${{ matrix.rust_target }} | ||
RUST_IMAGE=${{ matrix.rust_image }} | ||
cache-from: type=gha,scope=${{ matrix.arch }} | ||
cache-to: type=gha,mode=max,scope=${{ matrix.arch }} | ||
provenance: false | ||
|
||
create-manifest: | ||
name: create multi-arch manifest | ||
runs-on: ubuntu-latest | ||
needs: [extract-version, build-reproducible] | ||
if: ${{ github.event.inputs.dry_run != 'true' }} | ||
steps: | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ env.DOCKER_USERNAME }} | ||
password: ${{ env.DOCKER_PASSWORD }} | ||
|
||
- name: Create and push multi-arch manifest | ||
run: | | ||
IMAGE_NAME=${{ env.DOCKER_REPRODUCIBLE_IMAGE_NAME }} | ||
VERSION=${{ needs.extract-version.outputs.VERSION }} | ||
# Create manifest for version tag | ||
docker manifest create \ | ||
${IMAGE_NAME}:${VERSION} \ | ||
${IMAGE_NAME}:${VERSION}-amd64 \ | ||
${IMAGE_NAME}:${VERSION}-arm64 | ||
|
||
docker manifest push ${IMAGE_NAME}:${VERSION} | ||
|
||
# Create manifest for latest tag | ||
docker manifest create \ | ||
${IMAGE_NAME}:latest \ | ||
${IMAGE_NAME}:${VERSION}-amd64 \ | ||
${IMAGE_NAME}:${VERSION}-arm64 | ||
|
||
docker manifest push ${IMAGE_NAME}:latest | ||
|
||
dry-run-summary: | ||
name: dry run summary | ||
runs-on: ubuntu-latest | ||
needs: [build-reproducible, extract-version] | ||
if: ${{ github.event.inputs.dry_run == 'true' }} | ||
steps: | ||
- name: Summarize dry run | ||
run: | | ||
IMAGE_NAME=${{ env.DOCKER_REPRODUCIBLE_IMAGE_NAME }} | ||
VERSION=${{ needs.extract-version.outputs.VERSION }} | ||
echo "## 🧪 Reproducible Build Dry Run Summary" | ||
echo "" | ||
echo "✅ Successfully completed dry run for version ${VERSION}" | ||
echo "" | ||
echo "### What would happen in a real release:" | ||
echo "- Multi-arch reproducible Docker images would be built" | ||
echo "- Images would be pushed to Docker Hub as:" | ||
echo " - \`${IMAGE_NAME}:${VERSION}\`" | ||
echo " - \`${IMAGE_NAME}:latest\`" | ||
echo "" | ||
echo "### Architectures built:" | ||
echo "- linux/amd64 (x86_64-unknown-linux-gnu)" | ||
echo "- linux/arm64 (aarch64-unknown-linux-gnu)" | ||
echo "" | ||
echo "### Next Steps" | ||
echo "To perform a real release, push a git tag" | ||
echo "(e.g., \`git tag v4.6.0 && git push origin v4.6.0\`)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make reproducible builds a default for Lighthouse? Not an additional target requiring extra effort to support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a separate workflow for the reproducible container builds as separation of concerns similar to what the reth team did here https://github.com/paradigmxyz/reth/blob/main/.github/workflows/release-reproducible.yml