Skip to content

CI: Add automated SPDX SBOM generation workflow for releases#7505

Open
ArthPatel1502 wants to merge 1 commit into
OSGeo:mainfrom
ArthPatel1502:feature/sbom-generation-7215
Open

CI: Add automated SPDX SBOM generation workflow for releases#7505
ArthPatel1502 wants to merge 1 commit into
OSGeo:mainfrom
ArthPatel1502:feature/sbom-generation-7215

Conversation

@ArthPatel1502

Copy link
Copy Markdown
Contributor

Closes #7215

Proposed Changes

  • Adds ./workflows/sbom.yml to handle software asset inventory.
  • Implements Anchore sbom-action to systematically package dependencies into an industry-standard SPDX-JSON file format.
  • Automated generation triggers cleanly upon any new official tag/release being published.
  • Attaches the resulting grass-sbom.spdx.json artifact directly into the release distribution assets for seamless user download alongside binaries.
  • Includes workflow_dispatch access for dry-run validation profiles.

Acceptance Criteria Addressed

  • Automated generation on release milestones
  • Conforms to SPDX ecosystem specifications
  • Accessible alongside official delivery assets

@github-actions github-actions Bot added the CI Continuous integration label Jun 5, 2026
@echoix

echoix commented Jun 5, 2026

Copy link
Copy Markdown
Member

Don't we already have some workflows used for releases? Could it be attached there?

@nilason

nilason commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Don't we already have some workflows used for releases? Could it be attached there?

https://github.com/OSGeo/grass/blob/main/.github/workflows/create_release_draft.yml

But more importantly, our code base is far from being adapted to SPDX, see #4190.

@echoix

echoix commented Jun 5, 2026

Copy link
Copy Markdown
Member

The SBOM is not really related to the use of the license header.

We don't really ship a with a lot of external dependencies bundled, as we have vendored and modified copies of some parts, otherwise the dependencies come from the package manager that packages grass. With the exception of docker images, which we could create these sboms (more regularly than only on releases).

@ArthPatel1502

Copy link
Copy Markdown
Contributor Author

Thanks for linking the context from #4190, @nilason! I see the broader goal now. Luckily, as @echoix noted, our new release workflow scanner reads our top-level environment footprints rather than individual source headers, so this SBOM generation can safely land.

Once this PR is in a good spot, I would love to look into helping with the automated script migration over on #4190!

@echoix echoix left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would also be nice to have a real example of you actually running that workflow in your fork, (probably in both triggers), to show that it works as intended, and I'm curious to see if there is really anything inside that sbom that syft can really find by only checking out the repo.

I don't think there would be anything; yet here's a PR adding support for it. I would have expected it to be looking at what we are actually releasing, and probably also our docker images; that's where we are distributing built software that isn't our own. But these images can also be updated when there aren't any releases made

Comment on lines +5 to +6
release:
types: [published]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this fit in the direction that GitHub has on making releases immutable ?

This is adding to the release once it is released (like, after the emails and notifications have been sent)

Comment on lines +16 to +17
- name: Checkout Repository
uses: actions/checkout@v4

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pin with trailing comment of the full semver version; renovate keeps both updated.

You most probably didn't look it up on how to assemble that workflow, as that action's major version is at least 6, not 4.

Read other workflows in the repo to get you started

uses: actions/checkout@v4

- name: Generate SPDX SBOM
uses: anchore/sbom-action@v0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v0? Doesn't seem right. Is it mature enough to be 0? Anchore makes syft, and it's really not that new.

Comment on lines +27 to +28
- name: Upload SBOM as Run Artifact
uses: actions/upload-artifact@v4

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, follow the same version as other workflows in the repo.

And v4 is really out of date. We're at least at 7. Have you looked on what each inputs do to be confident on what your proposing?


- name: Attach SBOM to GitHub Release Assets
if: github.event_name == 'release'
uses: softprops/action-gh-release@v2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pin like others,it's also used in this repo. If my memory is right, a patch of 2.6.2 was released not too long ago, plus a v3 soon after.

Comment on lines +16 to +17
- name: Checkout Repository
uses: actions/checkout@v4

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably would need to set one of the newer inputs that removes the git credentials after checking out since we don't need to push anything after that step; I'll let you read personnaly on what it is called, so you can learn more

Comment on lines +5 to +6
release:
types: [published]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably would need to double check who is the "actor" of the published event on releases. If the releases are triggered by CI with the GITHUB_TOKEN, then it won't be able to trigger another job automatically. (Because it is not a PAT, but that restriction is to prevent shooting ourselves in the foot).

with:
name: grass-release-sbom
path: grass-sbom.spdx.json
retention-days: 90

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

90 days would work only if the repo or org wide settings aren't limiting that below this nombre of days

@echoix

echoix commented Jun 8, 2026

Copy link
Copy Markdown
Member

Learn to read zizmor's output; there's some more improvements to your style that would be beneficial

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] Add automated SBOM generation and publication for GRASS releases

3 participants