-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #459 from Mossaka/signing
feat(ci): add cosign to sign the released binaries
- Loading branch information
Showing
2 changed files
with
58 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -29,7 +29,10 @@ jobs: | |
shell: bash | ||
run: ./scripts/parse_ref.sh ${{ github.ref }} >> ${GITHUB_OUTPUT} | ||
|
||
build: | ||
build-and-sign: | ||
permissions: | ||
# cosign uses the GitHub OIDC token | ||
id-token: write | ||
needs: | ||
- parse | ||
strategy: | ||
|
@@ -38,30 +41,67 @@ jobs: | |
runs-on: "ubuntu-22.04" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup build env | ||
run: ./scripts/setup-linux.sh | ||
- uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
|
||
- name: Setup rust toolchain | ||
uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
env: | ||
RUST_CACHE_KEY_OS: rust-release-cache-${{ needs.parse.outputs.crate }}-${{ matrix.arch }} | ||
with: | ||
rustflags: '' #Disable. By default this action sets environment variable is set to -D warnings. We manage this in the Makefile | ||
|
||
- name: Setup cross-rs | ||
run: ./scripts/setup-cross.sh ${{ matrix.arch }}-unknown-linux-musl | ||
|
||
- name: Setup build profile | ||
shell: bash | ||
run: echo "OPT_PROFILE=release" >> ${GITHUB_ENV} | ||
|
||
- name: Setup cosign for signing | ||
uses: sigstore/[email protected] | ||
with: | ||
cosign-release: 'v2.2.2' | ||
|
||
- name: Build | ||
timeout-minutes: 20 | ||
run: make build-${{ needs.parse.outputs.runtime }} | ||
|
||
- name: Test | ||
if: ${{ matrix.arch == 'x86_64' }} | ||
timeout-minutes: 10 | ||
run: make test-${{ needs.parse.outputs.runtime }} | ||
|
||
- name: Sign the binary | ||
if: ${{ needs.parse.outputs.runtime != 'wasm' }} | ||
run: | | ||
make dist-${{ needs.parse.outputs.runtime }} | ||
# Check if there's any files to archive as tar fails otherwise | ||
if stat dist/bin/* >/dev/null 2>&1; then | ||
cosign sign-blob --yes \ | ||
--bundle containerd-shim-${{ needs.parse.outputs.runtime }}-v1.bundle \ | ||
dist/bin/containerd-shim-${{ needs.parse.outputs.runtime }}-v1 | ||
cosign sign-blob --yes \ | ||
--bundle containerd-shim-${{ needs.parse.outputs.runtime }}d-v1.bundle \ | ||
dist/bin/containerd-shim-${{ needs.parse.outputs.runtime }}d-v1 | ||
cosign sign-blob --yes \ | ||
--bundle containerd-${{ needs.parse.outputs.runtime }}d.bundle \ | ||
dist/bin/containerd-${{ needs.parse.outputs.runtime }}d | ||
# Copy the certs to the dist/bin folder | ||
cp *.sig dist/bin/ | ||
cp *.pem dist/bin/ | ||
else | ||
echo "No files to sign" | ||
fi | ||
- name: Package artifacts | ||
if: ${{ needs.parse.outputs.runtime != 'wasm' }} | ||
shell: bash | ||
run: | | ||
make dist-${{ needs.parse.outputs.runtime }} | ||
# Check if there's any files to archive as tar fails otherwise | ||
if stat dist/bin/* >/dev/null 2>&1; then | ||
tar -czf dist/containerd-shim-${{ needs.parse.outputs.runtime }}-${{ matrix.arch }}.tar.gz -C dist/bin . | ||
|
@@ -79,7 +119,7 @@ jobs: | |
permissions: | ||
contents: write | ||
needs: | ||
- build | ||
- build-and-sign | ||
- parse | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
This file contains 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