Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/build-and-publish.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions doc/changes/unreleased.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Unreleased

## Summary

## Features

* #905: Added SPDX SBOM generation to the `build-and-publish.yml` with the new Nox session `dependency:sbom`
4 changes: 3 additions & 1 deletion doc/user_guide/features/github_workflows/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ Maintained by the PTB
- Description
* - ``build-and-publish.yml``
- Workflow call
- Packages the distribution and publishes it to PyPi and GitHub.
- Packages the distribution and publishes it to PyPI, and creates a GitHub release
that includes an SPDX SBOM v2.

* - ``cd.yml``
- Push with new tag
- Manages continuous delivery by creating and uploading build artifacts and
Expand Down
24 changes: 24 additions & 0 deletions exasol/toolbox/nox/_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,27 @@ def report_resolved_vulnerabilities(session: Session) -> None:
current_vulnerabilities=get_vulnerabilities(path),
)
print(audit.report_resolved_vulnerabilities())


@nox.session(name="dependency:sbom", python=False)
def generate_sbom(session: Session) -> None:
"""Generate SPDX SBOM for the project dependencies.

Note: SPDX version 2 is used as no stable Python tool exists yet
for generating SPDX version 3.
"""
bom_cdx_json = PROJECT_CONFIG.root_path / "bom.cdx.json"
bom_spdx_json = PROJECT_CONFIG.root_path / "bom.spdx.json"
session.run("cyclonedx-py", "environment", "-o", bom_cdx_json)
session.run(
"sbomconvert",
"-i",
bom_cdx_json,
"--sbom",
"spdx",
"--format",
"json",
"-o",
bom_spdx_json,
)
session.run("test", "-s", bom_spdx_json)
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ jobs:
id: build-artifacts
run: poetry build

- name: Generate SBOM
id: generate-sbom
run: poetry run -- nox -s dependency:sbom

- name: Publish Release to PyPi
id: publish-release-to-pypi
env:
Expand All @@ -47,3 +51,4 @@ jobs:
--title ${GITHUB_REF_NAME}
--notes-file ./doc/changes/changes_${GITHUB_REF_NAME}.md
dist/*
bom.spdx.json
Loading