Added sbom#246
Draft
bluvulture wants to merge 2 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds SBOM generation to the Docker release workflow: enables --sbom=true during docker build, extracts the CycloneDX SBOM from the pushed image via docker buildx imagetools inspect, and uploads the resulting JSON files as a build artifact per matrix entry.
Changes:
- Enable SBOM attestations in the
docker buildstep. - Extract the CycloneDX SBOM from the pushed image into
sboms/sbom-<TAG>.cdx.json. - Add an
actions/upload-artifact@v7step to publish thesboms/directory.
Comments suppressed due to low confidence (2)
.github/workflows/release.yml:140
docker buildx imagetools inspect ${IMAGE_NAME}:${TAG}inspects the multi-arch manifest list at the registry. At this point in the loop, only the current architecture (linux/${ARCH_TAG}) has been pushed to that tag — the other architecture is pushed by a separate matrix job. Depending on timing/ordering between the two arch runners, the.SBOM.CycloneDXfield for${TAG}(which already contains-${ARCH_TAG}) should be a single-platform SBOM, but the--format '{{ json .SBOM.CycloneDX }}'output for a single-platform image is keyed by platform (e.g.{"linux/amd64": {...}}), not a bare CycloneDX document. The resultingsbom-*.cdx.jsonwill therefore not be a valid CycloneDX file consumable by standard tooling. Consider using--format '{{ json (index .SBOM "linux/<arch>").SPDX }}'-style indexing, ordocker buildx imagetools inspect --rawplus extraction, to produce a real CycloneDX document.
docker buildx imagetools inspect "${IMAGE_NAME}:${TAG}" \
--format '{{ json .SBOM.CycloneDX }}' > "sboms/sbom-${TAG}.cdx.json" || \
echo "Warning: Could not extract SBOM for ${TAG}"
.github/workflows/release.yml:171
- The "Upload SBOMs" step has no
if:condition, unlike the immediately preceding "Upload aggregated tags" step (line 160) which is gated ongithub.event_name != 'workflow_dispatch' || inputs.publish. When a user triggers the workflow viaworkflow_dispatchwithpublish: false,PUSHwill befalse, the SBOM extraction block at line 136 is skipped, andsboms/will not exist —if-no-files-found: ignorewill avoid a hard failure, but the step still runs unnecessarily and clutters the run with an empty/skipped artifact. For consistency with the adjacent upload step, consider adding the sameif:guard.
- name: Upload SBOMs
uses: actions/upload-artifact@v7
with:
name: sboms_${{ matrix.runner }}_${{ matrix.build.tag }}_${{ matrix.build.php }}_${{ matrix.build.distro }}_${{ matrix.build.version-override }}_${{ matrix.build.latest-tag }}
path: sboms/
if-no-files-found: ignore
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+138
to
+140
| docker buildx imagetools inspect "${IMAGE_NAME}:${TAG}" \ | ||
| --format '{{ json .SBOM.CycloneDX }}' > "sboms/sbom-${TAG}.cdx.json" || \ | ||
| echo "Warning: Could not extract SBOM for ${TAG}" |
Comment on lines
+166
to
+171
| - name: Upload SBOMs | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: sboms_${{ matrix.runner }}_${{ matrix.build.tag }}_${{ matrix.build.php }}_${{ matrix.build.distro }}_${{ matrix.build.version-override }}_${{ matrix.build.latest-tag }} | ||
| path: sboms/ | ||
| if-no-files-found: ignore |
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.
This pull request enhances the release workflow by generating, extracting, and attaching SBOMs (Software Bill of Materials) for Docker images. The changes improve supply chain transparency and automate SBOM handling throughout the build and release process.
SBOM Generation and Extraction:
--sbom=trueflag, ensuring SBOMs are included in the image build output.sboms/directory.SBOM Artifact Management: