Create build-attested-image.yml #217
Merged
Merged
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
Dargon789
added a commit
that referenced
this pull request
May 13, 2026
…updates (#910) * Add .circleci/config.yml * Create google.yml (#1) Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com> * Update config.yml (#3) Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com> * feat: upgrade c8 from 9.1.0 to 10.1.3 Snyk has created this PR to upgrade c8 from 9.1.0 to 10.1.3. See this package in npm: c8 See this project in Snyk: https://app.snyk.io/org/dargon789/project/68a3328a-d2b6-4975-b7db-af96a29fc4ac?utm_source=github-cloud-app&utm_medium=referral&page=upgrade-pr * feat: upgrade c8 from 9.1.0 to 10.1.3 Snyk has created this PR to upgrade c8 from 9.1.0 to 10.1.3. See this package in npm: c8 See this project in Snyk: https://app.snyk.io/org/dargon789/project/e2757016-0d48-429d-8c99-bffba0039c3a?utm_source=github-cloud-app&utm_medium=referral&page=upgrade-pr * Update google.yml (#11) Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com> * fix: packages/google-cloud-dialogflow-cx/samples/package.json to reduce vulnerabilities The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-JSYAML-13961110 * Create build-attested-image.yml (#217) * Create build-attested-image.yml CI: Introduce a build-attested-image workflow that builds and pushes a Docker image to GitHub Container Registry and generates build provenance attestations. Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com> * Update .github/workflows/build-attested-image.yml Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com> --------- Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com> Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * fix: packages/google-shopping-merchant-products/samples/package.json to reduce vulnerabilities (#214) The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-JSYAML-13961110 Co-authored-by: snyk-io[bot] <141718529+snyk-io[bot]@users.noreply.github.com> * fix: packages/google-cloud-kms-inventory/samples/package.json to reduce vulnerabilities (#213) The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-JSYAML-13961110 Co-authored-by: snyk-io[bot] <141718529+snyk-io[bot]@users.noreply.github.com> * fix: packages/google-cloud-certificatemanager/samples/package.json to reduce vulnerabilities (#212) The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-JSYAML-13961110 Co-authored-by: snyk-io[bot] <141718529+snyk-io[bot]@users.noreply.github.com> * fix: packages/google-cloud-workstations/samples/package.json to reduce vulnerabilities (#211) The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-JSYAML-13961110 Co-authored-by: snyk-io[bot] <141718529+snyk-io[bot]@users.noreply.github.com> * chore(deps): bump the npm_and_yarn group across 1 directory with 2 updates Bumps the npm_and_yarn group with 2 updates in the / directory: [brace-expansion](https://github.com/juliangruber/brace-expansion) and [js-yaml](https://github.com/nodeca/js-yaml). Updates `brace-expansion` from 1.1.11 to 1.1.12 - [Release notes](https://github.com/juliangruber/brace-expansion/releases) - [Commits](juliangruber/brace-expansion@1.1.11...v1.1.12) Updates `js-yaml` from 4.1.0 to 4.1.1 - [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md) - [Commits](nodeca/js-yaml@4.1.0...4.1.1) --- updated-dependencies: - dependency-name: brace-expansion dependency-version: 1.1.12 dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: js-yaml dependency-version: 4.1.1 dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <support@github.com> * fix: packages/google-cloud-iap/samples/package.json to reduce vulnerabilities The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-JSYAML-13961110 * Create cargo.yml (#221) CI: Introduce a CircleCI job that runs cargo fmt and cargo test using a Rust Docker image with caching for dependencies and build artifacts. https://github.com/apps/gemini-code-assist Highlights New CircleCI Configuration: A new CircleCI configuration file, .circleci/cargo.yml, has been added to the repository. Rust Build and Test Workflow: The new configuration defines a build-and-test job specifically for Rust projects, utilizing the cimg/rust:1.88.0 Docker image. Automated Code Quality Checks: The workflow includes steps to automatically check code formatting using cargo fmt -- --check and run all tests with cargo test. Dependency Caching: Caching mechanisms for Cargo dependencies are implemented to speed up subsequent CI runs by restoring and saving ~/.cargo and target directories. Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com> * Create ci-foundry.yml (#224) CI: Introduce a CircleCI 2.1 configuration file defining a custom Docker executor and a minimal workflow that checks out the repository and runs a placeholder command. Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com> * fix: packages/google-cloud-dataform/samples/package.json to reduce vulnerabilities (#209) The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-JSYAML-13961110 Co-authored-by: snyk-io[bot] <141718529+snyk-io[bot]@users.noreply.github.com> * fix: packages/google-devtools-cloudbuild/samples/package.json to reduce vulnerabilities (#208) The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-JSYAML-13961110 Co-authored-by: snyk-io[bot] <141718529+snyk-io[bot]@users.noreply.github.com> * Create jekyll-gh-pages.yml (#230) CI: Introduce a GitHub Actions workflow that builds the Jekyll site and deploys it to GitHub Pages using preinstalled dependencies. Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com> * Update config.yml (#232) CI: Simplify CircleCI configuration to a single Docker job that checks out the repo and echoes a greeting, orchestrated by a basic workflow. Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com> * fix: packages/google-cloud-workflows-executions/samples/package.json to reduce vulnerabilities (#207) The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-JSYAML-13961110 Co-authored-by: snyk-io[bot] <141718529+snyk-io[bot]@users.noreply.github.com> * fix: packages/google-shopping-merchant-promotions/samples/package.json to reduce vulnerabilities (#206) The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-JSYAML-13961110 Co-authored-by: snyk-io[bot] <141718529+snyk-io[bot]@users.noreply.github.com> * fix: packages/google-shopping-merchant-reviews/samples/package.json to reduce vulnerabilities (#205) The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-JSYAML-13961110 Co-authored-by: snyk-io[bot] <141718529+snyk-io[bot]@users.noreply.github.com> * fix: packages/google-cloud-filestore/samples/package.json to reduce vulnerabilities (#203) The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-JSYAML-13961110 Co-authored-by: snyk-io[bot] <141718529+snyk-io[bot]@users.noreply.github.com> * fix: packages/google-shopping-merchant-datasources/samples/package.json to reduce vulnerabilities (#228) The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-MOCHA-2863123 - https://snyk.io/vuln/SNYK-JS-INFLIGHT-6095116 - https://snyk.io/vuln/SNYK-JS-SERIALIZEJAVASCRIPT-6147607 - https://snyk.io/vuln/SNYK-JS-NANOID-2332193 - https://snyk.io/vuln/SNYK-JS-JSYAML-13961110 - https://snyk.io/vuln/SNYK-JS-MINIMATCH-3050818 - https://snyk.io/vuln/SNYK-JS-NANOID-8492085 Co-authored-by: snyk-io[bot] <141718529+snyk-io[bot]@users.noreply.github.com> * fix: packages/google-cloud-asset/samples/package.json to reduce vulnerabilities (#36) The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-JSYAML-13961110 Co-authored-by: snyk-io[bot] <141718529+snyk-io[bot]@users.noreply.github.com> * fix: packages/google-cloud-apihub/samples/package.json to reduce vulnerabilities (#227) The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-MOCHA-2863123 - https://snyk.io/vuln/SNYK-JS-INFLIGHT-6095116 - https://snyk.io/vuln/SNYK-JS-SERIALIZEJAVASCRIPT-6147607 - https://snyk.io/vuln/SNYK-JS-NANOID-2332193 - https://snyk.io/vuln/SNYK-JS-JSYAML-13961110 - https://snyk.io/vuln/SNYK-JS-MINIMATCH-3050818 - https://snyk.io/vuln/SNYK-JS-NANOID-8492085 Co-authored-by: snyk-io[bot] <141718529+snyk-io[bot]@users.noreply.github.com> * fix: packages/google-cloud-devicestreaming/samples/package.json to reduce vulnerabilities (#204) The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-JSYAML-13961110 Co-authored-by: snyk-io[bot] <141718529+snyk-io[bot]@users.noreply.github.com> * fix: packages/google-cloud-chronicle/samples/package.json to reduce vulnerabilities (#202) The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-JSYAML-13961110 Co-authored-by: snyk-io[bot] <141718529+snyk-io[bot]@users.noreply.github.com> * fix: packages/google-cloud-osconfig/samples/package.json to reduce vulnerabilities (#200) The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-JSYAML-13961110 Co-authored-by: snyk-io[bot] <141718529+snyk-io[bot]@users.noreply.github.com> * feat: Add `OFFLINE` state to Zone resources A new `OFFLINE` state has been added to the `Zone.State` enum. This state indicates that the zone is temporarily not operational, for example, while undergoing maintenance or repair PiperOrigin-RevId: 879057351 Source-Link: googleapis/googleapis@40a49dc Source-Link: https://github.com/googleapis/googleapis-gen/commit/77daef772d6cb525e73509d99da77c54c86cb597 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWdkY2hhcmR3YXJlbWFuYWdlbWVudC8uT3dsQm90LnlhbWwiLCJoIjoiNzdkYWVmNzcyZDZjYjUyNWU3MzUwOWQ5OWRhNzdjNTRjODZjYjU5NyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * build(deps): bump the npm_and_yarn group across 3 directories with 4 updates Bumps the npm_and_yarn group with 3 updates in the /core/generator/gapic-generator-typescript directory: [protobufjs](https://github.com/protobufjs/protobuf.js), [protobufjs-cli](https://github.com/protobufjs/protobuf.js) and [fast-xml-builder](https://github.com/NaturalIntelligence/fast-xml-builder). Bumps the npm_and_yarn group with 1 update in the /core/packages/gax/test/test-application directory: [@grpc/grpc-js](https://github.com/grpc/grpc-node). Bumps the npm_and_yarn group with 1 update in the /handwritten/cloud-profiler directory: [protobufjs](https://github.com/protobufjs/protobuf.js). Updates `protobufjs` from 7.5.5 to 7.5.6 - [Release notes](https://github.com/protobufjs/protobuf.js/releases) - [Changelog](https://github.com/protobufjs/protobuf.js/blob/protobufjs-v7.5.6/CHANGELOG.md) - [Commits](protobufjs/protobuf.js@protobufjs-v7.5.5...protobufjs-v7.5.6) Updates `protobufjs-cli` from 1.2.0 to 1.2.2 - [Release notes](https://github.com/protobufjs/protobuf.js/releases) - [Changelog](https://github.com/protobufjs/protobuf.js/blob/master/CHANGELOG.md) - [Commits](protobufjs/protobuf.js@protobufjs-cli-v1.2.0...protobufjs-cli-v1.2.2) Updates `fast-xml-builder` from 1.1.5 to 1.2.0 - [Changelog](https://github.com/NaturalIntelligence/fast-xml-builder/blob/main/CHANGELOG.md) - [Commits](NaturalIntelligence/fast-xml-builder@v1.1.5...v1.2.0) Updates `protobufjs` from 7.5.5 to 7.5.6 - [Release notes](https://github.com/protobufjs/protobuf.js/releases) - [Changelog](https://github.com/protobufjs/protobuf.js/blob/protobufjs-v7.5.6/CHANGELOG.md) - [Commits](protobufjs/protobuf.js@protobufjs-v7.5.5...protobufjs-v7.5.6) Updates `protobufjs` from 7.5.5 to 7.5.6 - [Release notes](https://github.com/protobufjs/protobuf.js/releases) - [Changelog](https://github.com/protobufjs/protobuf.js/blob/protobufjs-v7.5.6/CHANGELOG.md) - [Commits](protobufjs/protobuf.js@protobufjs-v7.5.5...protobufjs-v7.5.6) Updates `protobufjs` from 7.5.5 to 7.5.6 - [Release notes](https://github.com/protobufjs/protobuf.js/releases) - [Changelog](https://github.com/protobufjs/protobuf.js/blob/protobufjs-v7.5.6/CHANGELOG.md) - [Commits](protobufjs/protobuf.js@protobufjs-v7.5.5...protobufjs-v7.5.6) Updates `@grpc/grpc-js` from 1.6.12 to 1.14.3 - [Release notes](https://github.com/grpc/grpc-node/releases) - [Commits](https://github.com/grpc/grpc-node/compare/@grpc/grpc-js@1.6.12...@grpc/grpc-js@1.14.3) Updates `protobufjs` from 7.4.0 to 8.2.0 - [Release notes](https://github.com/protobufjs/protobuf.js/releases) - [Changelog](https://github.com/protobufjs/protobuf.js/blob/protobufjs-v7.5.6/CHANGELOG.md) - [Commits](protobufjs/protobuf.js@protobufjs-v7.5.5...protobufjs-v7.5.6) --- updated-dependencies: - dependency-name: protobufjs dependency-version: 7.5.6 dependency-type: direct:production dependency-group: npm_and_yarn - dependency-name: protobufjs-cli dependency-version: 1.2.2 dependency-type: direct:production dependency-group: npm_and_yarn - dependency-name: fast-xml-builder dependency-version: 1.2.0 dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: protobufjs dependency-version: 7.5.6 dependency-type: direct:production dependency-group: npm_and_yarn - dependency-name: protobufjs dependency-version: 7.5.6 dependency-type: direct:production dependency-group: npm_and_yarn - dependency-name: protobufjs dependency-version: 7.5.6 dependency-type: direct:production dependency-group: npm_and_yarn - dependency-name: "@grpc/grpc-js" dependency-version: 1.14.3 dependency-type: direct:production dependency-group: npm_and_yarn - dependency-name: protobufjs dependency-version: 8.2.0 dependency-type: direct:production dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <support@github.com> --------- Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com> Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com> Co-authored-by: snyk-io[bot] <141718529+snyk-io[bot]@users.noreply.github.com> Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: googleworkspace-bot <googleworkspace-bot@google.com>
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: