Skip to content

Add on-demand SBOM generation workflow#191

Open
Lukasz-Juranek wants to merge 1 commit intoeclipse-score:mainfrom
Lukasz-Juranek:feat/sbom-generation
Open

Add on-demand SBOM generation workflow#191
Lukasz-Juranek wants to merge 1 commit intoeclipse-score:mainfrom
Lukasz-Juranek:feat/sbom-generation

Conversation

@Lukasz-Juranek
Copy link
Contributor

@Lukasz-Juranek Lukasz-Juranek commented Mar 15, 2026

Summary

  • Adds score_sbom as a Bazel module dependency (via git_override)
  • Adds a root reference_integration_sbom Bazel target covering the core Rust showcase binaries (//showcases/cli:cli, //showcases/orchestration_persistency:orch_per_example)
  • Adds .github/workflows/generate_sbom.yml triggered only on workflow_dispatch (on-demand)

What the workflow does

  1. Builds SPDX 2.3 + CycloneDX 1.6 SBOMs via bazel build //:reference_integration_sbom
  2. Uploads both files as a GitHub Actions artifact (sbom-<sha>, retained 90 days)
  3. Converts the SPDX output to GitHub Dependency Submission API format and submits it — enables Dependabot vulnerability alerts on the declared dependencies

DependsOn: eclipse-score/sbom-tool#2

@github-actions
Copy link

The created documentation from the pull request is available at: docu-html

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an on-demand SBOM generation capability to the Bazel-based build, including a root SBOM target and a GitHub Actions workflow to build and publish SBOM artifacts and submit dependency snapshots to GitHub.

Changes:

  • Add score_sbom as a Bzlmod dependency (via git_override) and enable its metadata extension.
  • Introduce a root //:reference_integration_sbom Bazel target covering core showcase binaries.
  • Add a workflow_dispatch-only GitHub Actions workflow to generate/upload SBOMs and submit a dependency snapshot.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.

File Description
MODULE.bazel.lock Updates the Bzlmod lockfile to include score_sbom and transitive module resolution results.
MODULE.bazel Adds the score_sbom module override and configures the sbom_metadata extension to track this repo’s module.
BUILD Adds a root sbom(...) target reference_integration_sbom for key showcase binaries.
.github/workflows/generate_sbom.yml Adds a manual workflow to build SBOMs, upload them as artifacts, and submit a dependency snapshot to GitHub.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +77 to +79
# Use the script from the already-fetched @score_sbom external repo
SBOM_SCRIPTS="$(bazel info output_base)/external/score_sbom+/scripts"
python3 "${SBOM_SCRIPTS}/spdx_to_github_snapshot.py" \
sbom:
runs-on: ubuntu-latest
permissions:
contents: write # required for GitHub Dependency Submission API
Comment on lines +15 to +20
# Summary:
# Generates a Software Bill of Materials (SPDX 2.3 + CycloneDX 1.6) for the
# core showcase Bazel targets and stores the results as a GitHub Actions
# artifact. Optionally submits the SPDX snapshot to the GitHub Dependency
# Submission API to enable Dependabot vulnerability alerts.
#

- name: Install prerequisites (uv + Java for Rust crate metadata)
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
Comment on lines +58 to +60
- name: Install prerequisites (uv + Java for Rust crate metadata)
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
@Lukasz-Juranek
Copy link
Contributor Author

Response to review findings

Addressed all actionable review comments in commits 65aaa22, a004eb7, 71630b0:

# Finding Resolution
1 Fragile output_base path for script invocation Added py_binary target to sbom-tool (eclipse-score/sbom-tool#2); updated score_sbom reference; workflow now uses bazel run @score_sbom//scripts:spdx_to_github_snapshot_bin
2 dependency-graph: write permission Investigated — dependency-graph is not a valid GitHub Actions permission key. The Dependency Submission API requires contents: write, which was already correct.
3 Header says "optional" submission but always runs Updated header comment to accurately reflect that submission always runs
4 apt-get install without apt-get update Added apt-get update before install
5 curl | sh supply-chain risk Replaced with pinned astral-sh/setup-uv@v7.6.0 action

CI run on fork confirms full end-to-end success: https://github.com/Lukasz-Juranek/score-reference_integration/actions/runs/23180345273

  • SBOM built (SPDX 2.3 + CycloneDX 1.6, 126 packages)
  • Snapshot converted and submitted to GitHub Dependency Submission API

@Lukasz-Juranek
Copy link
Contributor Author

@kgraeper thx for looking at this.
when you have some call that i can join and explain what this PR is about ?

- Adds `score_sbom` as a Bazel module dependency (via `git_override`)
- Adds a root `reference_integration_sbom` Bazel target covering the core
  Rust showcase binaries (`//showcases/cli:cli`,
  `//showcases/orchestration_persistency:orch_per_example`)
- Adds `.github/workflows/generate_sbom.yml` triggered only on
  `workflow_dispatch` (on-demand)

What the workflow does:
1. Builds SPDX 2.3 + CycloneDX 1.6 SBOMs via
   `bazel build //:reference_integration_sbom`
2. Uploads both files as a GitHub Actions artifact (`sbom-<sha>`,
   retained 90 days)
3. Converts the SPDX output to GitHub Dependency Submission API format
   and submits it — enables Dependabot vulnerability alerts on the
   declared dependencies

Workflow improvements over initial draft:
- Use `astral-sh/setup-uv@v7.6.0` instead of `curl | sh` for
  reproducible, supply-chain-safe uv installation
- Add `apt-get update` before `apt-get install` to prevent intermittent
  failures on rotating runner images
- Invoke SPDX→snapshot converter via
  `bazel run @score_sbom//scripts:spdx_to_github_snapshot_bin` instead
  of reaching into Bazel's internal output_base directory; the required
  `py_binary` target is added in eclipse-score/sbom-tool#2
- Update header comment to accurately reflect that dependency snapshot
  submission always runs
- Use absolute paths (`$GITHUB_WORKSPACE`) for bazel run invocations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants