Skip to content
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

feat: Sign Atlantis containers before release (bonus points: speed up x86 builds) #5207

Merged
merged 23 commits into from
Dec 31, 2024
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
20916e8
add image attestation workflow step
notdurson Dec 12, 2024
104ae93
feat: add image signing and attestation workflow
notdurson Dec 19, 2024
8e51d50
Merge branch 'runatlantis:main' into main
notdurson Dec 27, 2024
7757507
add step to install cosign
notdurson Dec 27, 2024
4664940
rename attestation step
notdurson Dec 27, 2024
827a51c
add step to sign images with cosign
notdurson Dec 27, 2024
f7b020d
add -r to recursively sign images
notdurson Dec 27, 2024
1c1a119
Update cosign command to use --recursive=true for signing images
notdurson Dec 27, 2024
2213103
update matrix strategy to execute parallel builds
notdurson Dec 30, 2024
f3d1260
only sign alpine/amd64
notdurson Dec 30, 2024
594b7b6
chore(deps): update ghcr.io/runatlantis/testing-env:latest docker dig…
renovate[bot] Dec 28, 2024
f3a49c5
chore: fix typos (#5202)
chenrui333 Dec 28, 2024
356c13a
chore: fix typo pt2 (#5203)
chenrui333 Dec 28, 2024
2921c9b
chore(deps): update actions/upload-artifact action to v4.5.0 in .gith…
renovate[bot] Dec 29, 2024
2e16741
chore(deps): update github/codeql-action action to v3.28.0 in .github…
renovate[bot] Dec 30, 2024
07b6a4c
fix(deps): update module github.com/alicebob/miniredis/v2 to v2.34.0 …
renovate[bot] Dec 30, 2024
fad1b2b
use ubuntu-24.04 for all builds
notdurson Dec 30, 2024
9444e3d
Sign dev tags, version tags, and latest tags
notdurson Dec 30, 2024
c405f76
Merge branch 'runatlantis:main' into main
notdurson Dec 30, 2024
71a35fe
Start using setup-go
notdurson Dec 30, 2024
ae8a7bf
Actually use matrix platform input. Link to go.mod for version mgmt
notdurson Dec 30, 2024
6ec9c85
just sign all the tags for now
notdurson Dec 30, 2024
41d8aed
Merge branch 'main' into main
chenrui333 Dec 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions .github/workflows/atlantis-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
strategy:
matrix:
image_type: [alpine, debian]
platform: [linux/arm64/v8, linux/amd64, linux/arm/v7]
runs-on: ubuntu-24.04
env:
# Set docker repo to either the fork or the main repo where the branch exists
Expand All @@ -69,6 +70,11 @@ jobs:
with:
dockerfile: "Dockerfile"

- name: Set up Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version-file: "go.mod"

- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3
with:
Expand All @@ -82,6 +88,10 @@ jobs:
driver-opts: |
image=moby/buildkit:v0.14.0

- name: "Install cosign"
uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
if: env.PUSH == 'true' && github.event_name != 'pull_request'

# release version is the name of the tag i.e. v0.10.0
# release version also has the image type appended i.e. v0.10.0-alpine
# release tag is either pre-release or latest i.e. latest
Expand Down Expand Up @@ -146,21 +156,38 @@ jobs:
ATLANTIS_VERSION=${{ env.RELEASE_VERSION }}
ATLANTIS_COMMIT=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
ATLANTIS_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
platforms: linux/arm64/v8,linux/amd64,linux/arm/v7
platforms: ${{ matrix.platform }}
push: ${{ env.PUSH }}
tags: ${{ steps.meta.outputs.tags }}
target: ${{ matrix.image_type }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.description'] }}

- name: "Sign and Attest Image"
if: env.PUSH == 'true'
- name: "Create Image Attestation"
if: env.PUSH == 'true' && github.event_name != 'pull_request'
uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0
with:
subject-digest: ${{ steps.build.outputs.digest }}
subject-name: ghcr.io/${{ github.repository }}
push-to-registry: true

- name: "Sign images with environment annotations"
# no key needed, we're using the GitHub OIDC flow
# Only run on alpine/amd64 build to avoid signing multiple times
if: env.PUSH == 'true' && github.event_name != 'pull_request' && matrix.image_type == 'alpine' && matrix.platform == 'linux/amd64'
run: |
# Sign dev tags, version tags, and latest tags
echo "${TAGS}" | xargs -I {} cosign sign \
--yes \
--recursive=true \
-a actor=${{ github.actor}} \
-a ref_name=${{ github.ref_name}} \
-a ref=${{ github.sha }} \
{}@${DIGEST}
env:
TAGS: ${{ steps.meta.outputs.tags }}
DIGEST: ${{ steps.build.outputs.digest }}

test:
needs: [changes]
if: needs.changes.outputs.should-run-build == 'true'
Expand All @@ -169,6 +196,7 @@ jobs:
strategy:
matrix:
image_type: [alpine, debian]
platform: [linux/arm64/v8, linux/amd64, linux/arm/v7]
env:
# Set docker repo to either the fork or the main repo where the branch exists
DOCKER_REPO: ghcr.io/${{ github.repository }}
Expand Down Expand Up @@ -215,4 +243,5 @@ jobs:
image_type: [alpine, debian]
runs-on: ubuntu-24.04
steps:
- run: 'echo "No build required"'
- run: 'echo "No build required"'

Loading