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
10 changes: 5 additions & 5 deletions .github/actions/python-environment/ext/get_poetry.py

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

8 changes: 8 additions & 0 deletions .github/workflows/build-and-publish.yml

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

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

## Summary
* Added SPDX SBOM generation to the build-and-publish workflow using `cyclonedx-py` and `sbomconvert`
4 changes: 4 additions & 0 deletions doc/user_guide/features/github_workflows/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ Maintained by the PTB
* - ``build-and-publish.yml``
- Workflow call
- Packages the distribution and publishes it to PyPi and GitHub.
Also generates an SPDX SBOM (Software Bill of Materials) using
``cyclonedx-py`` and ``sbomconvert`` and attaches it to the GitHub release.
Note: SPDX version 2 is used as no stable Python tool exists yet
for generating SPDX version 3.
* - ``cd.yml``
- Push with new tag
- Manages continuous delivery by creating and uploading build artifacts and
Expand Down
29 changes: 29 additions & 0 deletions exasol/toolbox/nox/_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,32 @@ 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."""
session.run(
"poetry",
"run",
"cyclonedx-py",
"environment",
"-o",
"bom.cdx.json",
external=True,
)
session.run(
"poetry",
"run",
"sbomconvert",
"-i",
"bom.cdx.json",
"--sbom",
"spdx",
"--format",
"json",
"-o",
"bom.spdx.json",
external=True,
)
session.run("test", "-s", "bom.spdx.json", external=True)
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ jobs:
id: build-artifacts
run: poetry build

- name: Generate SBOM
id: generate-sbom
run: |
poetry run cyclonedx-py environment -o bom.cdx.json
poetry run sbomconvert -i bom.cdx.json --sbom spdx --format json -o bom.spdx.json
test -s bom.spdx.json

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