-
Notifications
You must be signed in to change notification settings - Fork 951
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
39
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
39 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 d93242f
refine the reproducible build and test arm github runner
MoeMahhouk febc138
make release-reproducible verify reproducibility
MoeMahhouk 19f2a0f
add label trigger for reproducible builds
MoeMahhouk 966ee01
Merge branch 'unstable' into unstable
chong-he c772026
Update lighthouse.service
MoeMahhouk f20ef0c
Merge branch 'unstable' into unstable
MoeMahhouk 5674e5a
Merge branch 'unstable' into unstable
chong-he bddc4f7
update rust version for github actions
MoeMahhouk 5e21162
addressing PR feedback
MoeMahhouk dbedf06
remove the release summary from docker-reproducible.yml
MoeMahhouk f4c1e46
removed exposed ports from the Dockerfile.reproducible
MoeMahhouk 2bcc784
add stable/unstable pushes to the docker-reproducible workflow
MoeMahhouk e838bfd
remove reproducible-builds workflow
MoeMahhouk 89847bf
Merge branch 'unstable' into unstable
MoeMahhouk 19768d6
remove unnecessary is_tag checks
MoeMahhouk 3431d03
manual workflow trigger is just for testing purposes only
MoeMahhouk 12c0574
Add reproducibility build for jemalloc-sys
MoeMahhouk 5613f2a
chore: remove unnecessary echo
MoeMahhouk 8740bcd
Remove redundant PROFILE in Makefile
michaelsproul a602f3e
Merge branch 'sigp:unstable' into unstable
MoeMahhouk 9a5b9b0
Add necessary setup for reproducible debian packaging
MoeMahhouk 3a9a1d5
add CI workflow to build and upload deb packages as assets
MoeMahhouk a93f8bc
merge the deb packaging workflow into release.yml to avoid conflicts
MoeMahhouk 246a159
refinements and following packaging best practices
MoeMahhouk 33c73f5
Merge branch 'deb-packaging' of https://github.com/MoeMahhouk/lightho…
MoeMahhouk a3436b9
remove merge conflict duplicates and fix lint issues
MoeMahhouk e09a200
remove testing script
MoeMahhouk e3dfb6f
lint cleanup
MoeMahhouk b42041b
chore: remove unused makefile target
MoeMahhouk 16fc7f5
remove unnecessary scripts
MoeMahhouk f399faf
chore: extract release reproducible binaries in their own workflow
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
Some comments aren't visible on the classic Files Changed page.
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
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,126 @@ | ||
| # This workflow signs and publishes reproducible artifacts | ||
| # It triggers when either Release Suite or docker-reproducible completes | ||
| # But only proceeds when BOTH have completed successfully for the same tag | ||
|
|
||
| name: release-reproducible | ||
|
|
||
| on: | ||
| workflow_run: | ||
| workflows: [Release Suite, docker-reproducible] | ||
| types: [completed] | ||
|
|
||
| jobs: | ||
| check-both-workflows: | ||
| name: verify both workflows completed | ||
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| should_proceed: ${{ steps.check.outputs.should_proceed }} | ||
| version: ${{ steps.check.outputs.version }} | ||
| steps: | ||
| - name: Check if both workflows completed successfully | ||
| id: check | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| # Get the tag/branch from the triggering workflow | ||
| TAG="${{ github.event.workflow_run.head_branch }}" | ||
|
|
||
| # Only proceed for version tags | ||
| if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then | ||
| echo "Not a version tag, skipping" | ||
| echo "should_proceed=false" >> $GITHUB_OUTPUT | ||
| exit 0 | ||
| fi | ||
|
|
||
| echo "Checking workflows for tag: $TAG" | ||
| echo "version=$TAG" >> $GITHUB_OUTPUT | ||
|
|
||
| # Check Release Suite status | ||
| RELEASE_SUCCESS=$(gh api /repos/${{ github.repository }}/actions/workflows/release.yml/runs \ | ||
| --jq ".workflow_runs[] | select(.head_branch == \"$TAG\" and .conclusion == \"success\") | .id" \ | ||
| | head -1) | ||
|
|
||
| # Check docker-reproducible status | ||
| DOCKER_SUCCESS=$(gh api /repos/${{ github.repository }}/actions/workflows/docker-reproducible.yml/runs \ | ||
| --jq ".workflow_runs[] | select(.head_branch == \"$TAG\" and .conclusion == \"success\") | .id" \ | ||
| | head -1) | ||
|
|
||
| if [[ -n "$RELEASE_SUCCESS" ]] && [[ -n "$DOCKER_SUCCESS" ]]; then | ||
| echo "Both workflows completed successfully for $TAG" | ||
| echo " - Release Suite: run $RELEASE_SUCCESS" | ||
| echo " - docker-reproducible: run $DOCKER_SUCCESS" | ||
| echo "should_proceed=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "Waiting for both workflows to complete for $TAG" | ||
| [[ -z "$RELEASE_SUCCESS" ]] && echo " - Release Suite: not completed" | ||
| [[ -z "$DOCKER_SUCCESS" ]] && echo " - docker-reproducible: not completed" | ||
| echo "should_proceed=false" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| sign-and-publish: | ||
| name: sign and publish reproducible artifacts | ||
| needs: check-both-workflows | ||
| if: needs.check-both-workflows.outputs.should_proceed == 'true' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| strategy: | ||
| matrix: | ||
| arch: [amd64, arm64] | ||
| include: | ||
| - arch: amd64 | ||
| rust_target: x86_64-unknown-linux-gnu | ||
| - arch: arm64 | ||
| rust_target: aarch64-unknown-linux-gnu | ||
| steps: | ||
| - name: Download reproducible artifacts | ||
| uses: dawidd6/action-download-artifact@v6 | ||
| with: | ||
| workflow: docker-reproducible.yml | ||
| name: reproducible-artifacts-${{ matrix.arch }} | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| branch: ${{ needs.check-both-workflows.outputs.version }} | ||
|
|
||
| - name: Prepare artifacts for signing | ||
| run: | | ||
| VERSION=${{ needs.check-both-workflows.outputs.version }} | ||
| ARCH_SHORT=$(echo "${{ matrix.rust_target }}" | cut -d'-' -f1) | ||
|
|
||
| # Rename binary and create tarball | ||
| mv lighthouse-${{ matrix.arch }} lighthouse-reproducible-${VERSION}-${{ matrix.rust_target }} | ||
| tar -czf lighthouse-reproducible-${VERSION}-${{ matrix.rust_target }}.tar.gz \ | ||
| lighthouse-reproducible-${VERSION}-${{ matrix.rust_target }} --remove-files | ||
|
|
||
| # Rename Debian package | ||
| mv lighthouse-${{ matrix.arch }}.deb lighthouse-${VERSION}-${ARCH_SHORT}-reproducible.deb | ||
|
|
||
| - name: Sign artifacts with GPG | ||
| env: | ||
| GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} | ||
| GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
| run: | | ||
| export GPG_TTY=$(tty) | ||
| echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --batch --import | ||
|
|
||
| VERSION=${{ needs.check-both-workflows.outputs.version }} | ||
| ARCH_SHORT=$(echo "${{ matrix.rust_target }}" | cut -d'-' -f1) | ||
|
|
||
| # Sign binary tarball | ||
| echo "$GPG_PASSPHRASE" | gpg --passphrase-fd 0 --pinentry-mode loopback --batch -ab \ | ||
| lighthouse-reproducible-${VERSION}-${{ matrix.rust_target }}.tar.gz | ||
|
|
||
| # Sign Debian package | ||
| echo "$GPG_PASSPHRASE" | gpg --passphrase-fd 0 --pinentry-mode loopback --batch -ab \ | ||
| lighthouse-${VERSION}-${ARCH_SHORT}-reproducible.deb | ||
|
|
||
| - name: Upload reproducible artifacts to release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| VERSION=${{ needs.check-both-workflows.outputs.version }} | ||
|
|
||
| # Upload all signed artifacts and their signatures | ||
| gh release upload ${VERSION} \ | ||
| lighthouse-reproducible-*.tar.gz* \ | ||
| lighthouse-*-reproducible.deb* | ||
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
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
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
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,16 @@ | ||
| [Unit] | ||
| Description=Lighthouse Ethereum Beacon Node | ||
| After=network.target | ||
| Wants=network.target | ||
|
|
||
| [Service] | ||
| Type=exec | ||
| DynamicUser=yes | ||
| StateDirectory=lighthouse | ||
| ExecStart=/usr/bin/lighthouse bn \ | ||
| --execution-endpoint http://localhost:8551 \ | ||
| --execution-jwt-secret-key 0000000000000000000000000000000000000000000000000000000000000000 | ||
| --datadir %S/lighthouse | ||
|
|
||
| [Install] | ||
| WantedBy=default.target |
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,12 @@ | ||
| #!/bin/sh | ||
| set -e | ||
|
|
||
| if [ "$1" = "remove" ]; then | ||
| # Stop service if running | ||
| systemctl stop lighthouse || true | ||
| systemctl disable lighthouse || true | ||
| fi | ||
|
|
||
| #DEBHELPER# | ||
|
|
||
| exit 0 |
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.
This block does not actually wait for the completion of another workflow that this workflow depends on, it checks the status and exits if not ready.
As per GH docs when multiple WFs specified in
workflows: [Release Suite, docker-reproducible]only one needs to complete, the other could still be running whenrelease-reproducibleis triggered. So we need to actually wait for the completion periodically checking the status of a WF.