-
Notifications
You must be signed in to change notification settings - Fork 2
feat: publish Docker image to GHCR #218
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
Changes from 13 commits
bd884e4
869f4c4
ae8ea58
8899d9e
ba8293d
0b4551c
605472f
d4096ce
5f0c9e8
174bbbc
f5f4e76
e2fdf9e
96fbba5
5947d0c
1db8ce6
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,62 @@ | ||
| name: Docker Image | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - master | ||
| - release/** | ||
| jobs: | ||
| build-docker-image: | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - os: ubuntu-24.04 | ||
| platform: amd64 | ||
| - os: ubuntu-24.04-arm | ||
| platform: arm64 | ||
| name: build-docker-image-${{ matrix.platform }} | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
|
|
||
| - name: Build and push chartcuterie image | ||
| uses: getsentry/action-build-and-push-images@b172ab61a5f7eabd58bd42ce231b517e79947c01 | ||
| with: | ||
| image_name: 'chartcuterie' | ||
| platforms: linux/${{ matrix.platform }} | ||
| dockerfile_path: './Dockerfile' | ||
| ghcr: ${{ github.event_name != 'pull_request' }} | ||
| tag_suffix: -${{ matrix.platform }} | ||
| publish_on_pr: ${{ github.event.pull_request.author_association == 'OWNER' || github.event.pull_request.author_association == 'MEMBER' }} | ||
| google_ar: false | ||
| tag_nightly: false | ||
| tag_latest: false | ||
|
|
||
| assemble-chartcuterie-image: | ||
| runs-on: ubuntu-latest | ||
| needs: [build-docker-image] | ||
| if: ${{ (github.ref_name == 'master' || startsWith(github.ref_name, 'release/')) && github.event_name != 'pull_request' }} | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
|
|
||
| - run: docker login --username '${{ github.actor }}' --password-stdin ghcr.io <<< "$GHCR_TOKEN" | ||
| env: | ||
| GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 | ||
|
|
||
| - name: Create multiplatform manifests | ||
| run: | | ||
| docker buildx imagetools create \ | ||
| --tag ghcr.io/getsentry/chartcuterie:${{ github.event.pull_request.head.sha || github.sha }} \ | ||
| --tag ghcr.io/getsentry/chartcuterie:nightly \ | ||
|
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. Release pushes overwrite nightly image tagMedium Severity
|
||
| ghcr.io/getsentry/chartcuterie:${{ github.event.pull_request.head.sha || github.sha }}-amd64 \ | ||
| ghcr.io/getsentry/chartcuterie:${{ github.event.pull_request.head.sha || github.sha }}-arm64 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| name: Release GHCR Versioned Image | ||
|
|
||
| on: | ||
| release: | ||
| types: [prereleased, released] | ||
|
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. Prereleases retagged as latest imageMedium Severity The workflow triggers on Additional Locations (1) |
||
|
|
||
| jobs: | ||
|
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. Bug: The Suggested FixAdd a jobs:
release-ghcr-version-tag:
runs-on: ubuntu-latest
permissions:
contents: read
packages: writePrompt for AI Agent
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. This is fine. I'm waiting for #202 to be merged. Only then, we can move the release pipeline into Craft rather than relying on GHA like this. |
||
| release-ghcr-version-tag: | ||
| runs-on: ubuntu-latest | ||
|
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. Missing packages write permission blocks GHCR pushHigh Severity The |
||
| steps: | ||
| - name: Log in to GitHub Container Registry | ||
| uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Tag release version | ||
| run: | | ||
| docker buildx imagetools create --tag \ | ||
| ghcr.io/getsentry/chartcuterie:${{ github.ref_name }} \ | ||
| ghcr.io/getsentry/chartcuterie:${{ github.sha }} | ||
|
aldy505 marked this conversation as resolved.
|
||
|
|
||
| - name: Tag latest version | ||
| run: | | ||
| docker buildx imagetools create --tag \ | ||
| ghcr.io/getsentry/chartcuterie:latest \ | ||
| ghcr.io/getsentry/chartcuterie:${{ github.sha }} | ||


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.
Bug: The workflow unconditionally applies the
nightlytag to images built fromrelease/**branches, which should only be applied to builds from themasterbranch.Severity: HIGH
Suggested Fix
The command that applies the
nightlytag should be wrapped in a conditional check to ensure it only executes when the event is triggered from themasterbranch, for example, by adding anif: github.ref_name == 'master'condition to the step.Prompt for AI Agent
Did we get this right? 👍 / 👎 to inform future reviews.