Repository navigation
ci: prepare reproducible source archives for automated signing #318
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
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 |
|---|---|---|
|
|
@@ -32,3 +32,44 @@ Trusted Publishing is already configured for `asyncband`: repository `apache/asy | |
| Candidates are staged under `https://dist.apache.org/repos/dist/dev/incubator/asyncband/`; approved releases are promoted to `https://dist.apache.org/repos/dist/release/incubator/asyncband/`. The public verification key list is `https://downloads.apache.org/incubator/asyncband/KEYS`. | ||
|
|
||
| The release manager uses an ASF-associated signing key published in the existing project `KEYS` file. For a new signing key, follow the [ASF release signing guide](https://infra.apache.org/release-signing.html), verify the fingerprint through an independent channel, and add the public key while preserving existing keys. Reuse established distribution areas and signing configuration; investigate a reported access or verification failure before proposing infrastructure changes. | ||
|
|
||
| ## CI source signing | ||
|
|
||
| `.github/workflows/source.yml` prepares a source archive and optionally signs it in one job. Pull requests and default manual runs produce unsigned artifacts. Signing runs only on an explicit manual dispatch from `apache/asyncband`'s `main` branch with `sign=true`; the secret is passed to that step. Packaging and signing share one trusted environment. The signing step imports the Infra-managed key into a temporary GPG home, checks the primary fingerprint, signs the expected source archive, and verifies the signature. The workflow uploads the resulting bundle once as a GitHub Actions artifact. It has read-only repository access and no OIDC permission; it does not stage, vote, create tags, or publish. | ||
|
|
||
| ### Provisioning | ||
|
|
||
| Request a project signing key from ASF Infra and submit this workflow plus reproducibility evidence to ASF Security. Obtain workflow approval before enabling signing. Follow the [ASF automated release signing procedure](https://infra.apache.org/release-signing.html#automated-release-signing). Infra generates and installs the private key; project members must not export a personal key or request delivery of this private key. | ||
|
|
||
| | Configuration | Value or owner | | ||
| | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | | ||
| | Repository | `apache/asyncband` | | ||
| | Repository secret | `GPG_SECRET_KEY`, installed by Infra; the signing command expects the Infra key to have an empty passphrase | | ||
| | Repository variable | `SOURCE_SIGNING_FINGERPRINT`, the full uppercase primary fingerprint supplied by Infra | | ||
| | Public key | Add to the existing Asyncband `KEYS`, preserving other keys and the current KEYS management mode | | ||
| | Suggested primary UID | `Apache Asyncband Automated Release Signing <[email protected]>`; confirm the committee association with Infra/Tooling | | ||
|
|
||
| Once approval, provisioning, and public-key publication are complete, the release manager opens GitHub Actions and manually runs **Source candidate** on `main` with **sign** enabled. Record the run URL, full source commit, checksum, and signing fingerprint. Download the `signed-source` artifact and retain the archive, checksum, and signature as the candidate bytes. A retry should reuse an existing signed bundle when available. This workflow has no schedule; ATR upload is a separate integration to add after key provisioning. | ||
|
|
||
| ### Reproduce before staging and voting | ||
|
|
||
| The release manager must reproduce the source archive on trusted hardware outside GitHub Actions, using a fresh checkout of the exact commit printed in the workflow summary. Compare against the actual downloaded archive, not merely its checksum file. Git produces the tar.gz archive with compression level 9 and a fixed archive umask; `shasum` produces the checksum and `cmp` compares the archive bytes. Run the following from that clean checkout, after setting `DOWNLOADED_ARCHIVE` to the absolute path of the downloaded `.tar.gz`: | ||
|
|
||
| ```shell | ||
| set -eu | ||
| git diff --quiet HEAD -- | ||
| RELEASE_COMMIT="$(git rev-parse --verify 'HEAD^{commit}')" | ||
| VERSION="$(sed -n 's/^version = "\(.*\)"$/\1/p' asyncband/Cargo.toml)" | ||
| SOURCE_DIR="apache-asyncband-${VERSION}-incubating-src" | ||
| REPRO_DIR="$(mktemp -d "${TMPDIR:-/tmp}/asyncband-reproduce.XXXXXX")" | ||
| git -c tar.umask=0022 archive --format=tar.gz -9 \ | ||
| --prefix="${SOURCE_DIR}/" \ | ||
| --output="${REPRO_DIR}/${SOURCE_DIR}.tar.gz" "${RELEASE_COMMIT}" | ||
| cmp "${REPRO_DIR}/${SOURCE_DIR}.tar.gz" "${DOWNLOADED_ARCHIVE}" | ||
| shasum -a 512 "${DOWNLOADED_ARCHIVE}" | ||
| git --version | ||
| ``` | ||
|
|
||
| `cmp` fails on any byte difference, including gzip headers or compression differences. Do not accept merely equivalent extracted contents as evidence for automated signing. If the output differs, check the source commit, Git versions, compression settings, and Git configuration before accepting the candidate. Do not use local Git attribute or archive-compressor overrides in the reproduction checkout. Untracked files are not part of `git archive`; tracked edits are rejected. | ||
|
|
||
| After staging, download the candidate again and repeat the comparison and signature verification against the published `KEYS`. Record the candidate revision, source commit, SHA-512, tool versions, and result in the vote evidence. Reviewers independently reproduce these same bytes on trusted hardware before publication. CI generation, a valid automated signature, and a passing build do not replace this check. The existing source-content, build, licensing, PPMC/IPMC voting, and final publication requirements still apply. No compiled binaries or crates.io packages are signed by this workflow. | ||
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,104 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| name: Source candidate | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - .github/workflows/source.yml | ||
| - asyncband/Cargo.toml | ||
| - .gitattributes | ||
| - .agents/skills/release/** | ||
| workflow_dispatch: | ||
| inputs: | ||
| sign: | ||
| description: Sign with the Infra-managed key (requires ASF Security approval) | ||
| type: boolean | ||
| default: false | ||
|
Comment on lines
+21
to
+32
Member
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. Who would trigger the
Member
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. I suppose we may leverage some ATR actions to just upload the package files there. |
||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: source-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| source: | ||
| name: Prepare source archive | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 15 | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | ||
| persist-credentials: false | ||
| - name: Package committed source | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| git diff --quiet HEAD -- | ||
| revision="$(git rev-parse --verify 'HEAD^{commit}')" | ||
| version="$(sed -n 's/^version = "\(.*\)"$/\1/p' asyncband/Cargo.toml)" | ||
| [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] | ||
| source_dir="apache-asyncband-${version}-incubating-src" | ||
| mkdir "$RUNNER_TEMP/source" | ||
| git -c tar.umask=0022 archive --format=tar.gz -9 \ | ||
| --prefix="${source_dir}/" \ | ||
| --output="$RUNNER_TEMP/source/${source_dir}.tar.gz" "$revision" | ||
| cd "$RUNNER_TEMP/source" | ||
| shasum -a 512 "${source_dir}.tar.gz" > "${source_dir}.tar.gz.sha512" | ||
| { | ||
| printf 'Commit: %s\nVersion: %s\n' "$revision" "$version" | ||
| git --version | ||
| cat "${source_dir}.tar.gz.sha512" | ||
| } | tee -a "$GITHUB_STEP_SUMMARY" | ||
| - name: Sign and verify | ||
| id: sign | ||
| if: >- | ||
| github.event_name == 'workflow_dispatch' && inputs.sign && | ||
| github.repository == 'apache/asyncband' && github.ref == 'refs/heads/main' | ||
| shell: bash | ||
| working-directory: ${{ runner.temp }}/source | ||
| env: | ||
| SIGNING_KEY: ${{ secrets.GPG_SECRET_KEY }} | ||
| SIGNING_FINGERPRINT: ${{ vars.SOURCE_SIGNING_FINGERPRINT }} | ||
| GNUPGHOME: ${{ runner.temp }}/source-gnupg | ||
| run: | | ||
| set -euo pipefail | ||
| test -n "$SIGNING_KEY" | ||
| [[ "$SIGNING_FINGERPRINT" =~ ^[0-9A-F]{40}$ ]] | ||
| shopt -s nullglob | ||
| archives=(*.tar.gz) | ||
| test "${#archives[@]}" -eq 1 | ||
| archive="${archives[0]}" | ||
| [[ "$archive" =~ ^apache-asyncband-[0-9]+\.[0-9]+\.[0-9]+-incubating-src\.tar\.gz$ ]] | ||
|
|
||
| mkdir -m 700 "$GNUPGHOME" | ||
| trap 'gpgconf --kill all; rm -rf "$GNUPGHOME"' EXIT | ||
| printf '%s' "$SIGNING_KEY" | gpg --batch --import | ||
| fingerprint="$(gpg --batch --with-colons --list-secret-keys | awk -F: '$1 == "fpr" { print $10; exit }')" | ||
| test "$fingerprint" = "$SIGNING_FINGERPRINT" | ||
| gpg --batch --pinentry-mode loopback --passphrase '' \ | ||
| --local-user "$SIGNING_FINGERPRINT!" --armor --detach-sign "$archive" | ||
| gpg --batch --verify "$archive.asc" "$archive" | ||
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | ||
| with: | ||
| name: ${{ steps.sign.outcome == 'success' && 'signed-source' || 'unsigned-source' }} | ||
| path: ${{ runner.temp }}/source/ | ||
| if-no-files-found: error | ||
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.
Uh oh!
There was an error while loading. Please reload this page.