Conversation
Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
|
Note Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported. |
Reviewer's GuideAdds a new GitHub Actions workflow that builds, pushes, and generates build-provenance attestations for a container image in GitHub Container Registry whenever changes are pushed to the main branch. Flow diagram for the build-attested-image GitHub Actions workflowflowchart TD
A["Push to 'main' branch"] --> B["Start 'build-attested-image' workflow"]
B --> C["Provision 'ubuntu-latest' runner with required permissions"]
C --> D["Set env: REGISTRY=ghcr.io, IMAGE_NAME=github.repository"]
D --> E["Checkout source code (actions/checkout@v4)"]
E --> F["Login to GHCR (docker/login-action@v3) using GITHUB_TOKEN"]
F --> G["Build and push container image (docker/build-push-action@v5.0.0) with tag REGISTRY/IMAGE_NAME:latest"]
G --> H["Capture pushed image digest from step 'push' outputs"]
H --> I["Generate build-provenance attestation (actions/attest-build-provenance@v1)"]
I --> J["Attach and push attestation to GHCR for image REGISTRY/IMAGE_NAME at subject-digest"]
J --> K["Workflow completed with attested image in GHCR"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
- Consider tagging the pushed image with a deterministic value (e.g., the commit SHA or release/tag name) in addition to
:latestso that builds are traceable and reproducible across commits. - You may want to restrict the workflow trigger (e.g., using
pathsfilters or additional conditions) so this image build only runs when relevant files like the Dockerfile or application code change, avoiding unnecessary builds on unrelated pushes.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider tagging the pushed image with a deterministic value (e.g., the commit SHA or release/tag name) in addition to `:latest` so that builds are traceable and reproducible across commits.
- You may want to restrict the workflow trigger (e.g., using `paths` filters or additional conditions) so this image build only runs when relevant files like the Dockerfile or application code change, avoiding unnecessary builds on unrelated pushes.
## Individual Comments
### Comment 1
<location> `.github/workflows/build-attested-image.yml:28-34` </location>
<code_context>
+ registry: ${{ env.REGISTRY }}
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+ - name: Build and push image
+ id: push
+ uses: docker/build-push-action@v5.0.0
+ with:
+ context: .
+ push: true
+ tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
+ - name: Attest
+ uses: actions/attest-build-provenance@v1
</code_context>
<issue_to_address>
**suggestion:** Consider tagging images with an immutable identifier in addition to `latest` to avoid ambiguity and rollout issues.
Because `latest` is mutable, it will point to different images over time, which complicates rollbacks and provenance tracking. To keep `latest` for convenience while also having a stable reference, please add an immutable tag (e.g., Git SHA or version) alongside it, for example:
- `tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}`
```suggestion
- name: Build and push image
id: push
uses: docker/build-push-action@v5.0.0
with:
context: .
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
```
</issue_to_address>
### Comment 2
<location> `.github/workflows/build-attested-image.yml:35-39` </location>
<code_context>
+ context: .
+ push: true
+ tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
+ - name: Attest
+ uses: actions/attest-build-provenance@v1
+ id: attest
+ with:
+ subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+ subject-digest: ${{ steps.push.outputs.digest }}
+ push-to-registry: true
</code_context>
<issue_to_address>
**suggestion:** Align attestation subject with the exact image reference (including tag) to avoid ambiguity.
The attestation uses `subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}` while the image is pushed as `.../${{ env.IMAGE_NAME }}:latest`. Please include the tag in `subject-name` so the attestation unambiguously matches the pushed image, for example:
- `subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest`
If you later use immutable tags, mirror those here instead.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
This was
linked to
issues
Nov 22, 2025
This was
linked to
issues
Dec 10, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> 🦕
Summary by Sourcery
CI: