-
Notifications
You must be signed in to change notification settings - Fork 961
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
base: unstable
Are you sure you want to change the base?
Changes from 39 commits
9a2d6da
10a3b59
a4348b2
608caab
b946c49
d58a9c1
af4c59b
211063a
d93242f
febc138
19f2a0f
966ee01
c772026
f20ef0c
5674e5a
bddc4f7
5e21162
dbedf06
f4c1e46
2bcc784
e838bfd
89847bf
19768d6
3431d03
12c0574
5613f2a
8740bcd
a602f3e
9a5b9b0
3a9a1d5
a93f8bc
246a159
33c73f5
a3436b9
e09a200
e3dfb6f
b42041b
16fc7f5
f399faf
e70ae3d
ec87ee3
20ba94f
3db8647
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes exactly, that is why I introduced the |
||
| 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* | ||
| 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 |
| 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 |
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