Skip to content

fix(ci): anchor SBOM output path to GITHUB_WORKSPACE - #26

Merged
williaby merged 1 commit into
mainfrom
fix/sbom-outfile-path
Apr 10, 2026
Merged

williaby merged 1 commit into
mainfrom
fix/sbom-outfile-path

Conversation

@williaby

@williaby williaby commented Apr 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The Generate runtime SBOM step was writing sbom-runtime.json relative to the shell's CWD. In a reusable workflow (workflow_call) the shell CWD and $GITHUB_WORKSPACE can diverge, so the file landed outside the workspace root that upload-artifact v4 resolves globs against. The upload step then reported "No files were found with the provided path: sbom-*.json" even though wc -c showed the file at 17768 bytes (confirmed in run 24250664647).

Changes

  • Absolute --outfile path: --outfile "$GITHUB_WORKSPACE/sbom-runtime.json" anchors the output file to the same root that upload-artifact uses, eliminating the CWD vs workspace ambiguity.
  • Hardened guard: upgraded from -f (file exists) to -s (file non-empty) so the guard also catches the 0-byte output that cyclonedx-py produces when the interpreter path is missing.
  • Absolute upload path: changed from sbom-*.json to ${{ github.workspace }}/sbom-*.json so the upload glob roots from the same absolute location the file was written to.
  • Diagnostic step: added Verify SBOM files before upload that logs pwd, $GITHUB_WORKSPACE, and a find listing of matching files — provides immediate evidence if this class of failure recurs without needing to re-diagnose from scratch.

Impact

  • Fixes the artifact-not-found failure that has been breaking every SBOM run since at least March 2026
  • No interface changes for callers

Testing

  • Trigger the SBOM workflow in a calling repo and confirm the Verify SBOM files before upload step shows the file
  • Confirm scan-runtime and license-compliance jobs run and complete

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Improved SBOM artifact generation with enhanced validation and diagnostic checks to ensure more reliable build process artifacts.

The generate step was creating sbom-runtime.json relative to the
shell's CWD, which in a reusable workflow context may differ from
$GITHUB_WORKSPACE — the root that upload-artifact v4 resolves
against. This explains why the file existed (17768 bytes confirmed
by wc -c in run 24250664647) but the upload step still reported
"No files were found with the provided path: sbom-*.json".

Changes:
- --outfile now uses the absolute path "$GITHUB_WORKSPACE/sbom-runtime.json"
  so the file is always written to the location upload-artifact expects
- Guard upgraded from -f (exists) to -s (non-empty) to also catch the
  0-byte output case cyclonedx-py produces when the interpreter is missing
- Upload path changed to ${{ github.workspace }}/sbom-*.json to match
  the absolute write location and remove glob-root ambiguity
- Added "Verify SBOM files before upload" step that logs pwd vs
  GITHUB_WORKSPACE and lists matching files; provides diagnostic
  evidence if this class of failure ever recurs

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 10, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f6d402dd-311c-43be-b566-9cf514167ecb

📥 Commits

Reviewing files that changed from the base of the PR and between 9f9b596 and f06e397.

📒 Files selected for processing (1)
  • .github/workflows/python-sbom.yml

📝 Walkthrough

Walkthrough

This pull request hardens the CycloneDX SBOM generation workflow by updating artifact paths to use GitHub workspace explicitly, strengthening file validation from existence checks to non-empty file verification, adding workspace diagnostics, and verifying artifacts before upload.

Changes

Cohort / File(s) Summary
SBOM Workflow Hardening
.github/workflows/python-sbom.yml
Updated CycloneDX SBOM output path to use $GITHUB_WORKSPACE explicitly, strengthened file validation to check for non-empty files, added workspace diagnostics and artifact verification step, and changed artifact upload path from relative to absolute glob pattern.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 Artifacts now roam free in workspaces so clear,
Non-empty files verified, no ghosts living here,
Diagnostics and uploads in absolute harmony,
The SBOM flows proudly through GitHub's treasury! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description covers the problem, changes made, impact, and testing requirements, though it does not follow the repository's template structure with required sections. Consider restructuring the description to follow the template with explicit sections: Description, Related Issue, Type of Change, Changes Made, and Testing.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: anchoring SBOM output path to GITHUB_WORKSPACE to fix a CI workflow issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sbom-outfile-path

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@williaby
williaby merged commit 400193f into main Apr 10, 2026
4 checks passed
williaby added a commit that referenced this pull request Apr 10, 2026
upload-artifact@v4 requires a workspace-relative path. The absolute
\${{ github.workspace }}/sbom-*.json prefix introduced in #26 was
causing "No files were found" even though the file existed at that
path (confirmed by the Verify step in run 24256290551). The action
resolves globs from \$GITHUB_WORKSPACE by default, so the bare
relative glob sbom-*.json is correct.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@williaby
williaby deleted the fix/sbom-outfile-path branch April 18, 2026 21:13
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.

1 participant