Skip to content

Commit e0f868b

Browse files
refactor: restrict sbom generation to semantic version tags
1 parent e0a7b9f commit e0f868b

2 files changed

Lines changed: 5 additions & 20 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ The SBOM is stored as job artifact and published to the project's Generic Packag
145145
Includes:
146146
- `security/security-sbom.yaml`
147147

148-
Runs on semantic version tags and manually on the default branch. Published as `packages/generic/sbom/<version>/sbom.cdx.json`, where `<version>` is the tag without a leading `v` or `0.0.0-<short-sha>` for untagged builds.
148+
Runs on semantic version tags only, matching the prod deployment. Published as `packages/generic/sbom/<version>/sbom.cdx.json`, where `<version>` is the tag without a leading `v`.
149149

150150
> [!IMPORTANT]
151151
> Technical documentation has to be kept for the declared support period. Make sure the project has no cleanup policy that removes generic packages.

security/security-sbom.yaml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,8 @@ security:sbom:
2828
SBOM_PACKAGE_NAME: "sbom"
2929
script:
3030
- command -v curl > /dev/null 2>&1 || apk add --no-cache curl
31-
## Version for the package registry, which only accepts semantic versions:
32-
## tags may carry a leading "v" and a commit sha is no valid version on its own
33-
- >
34-
if [ -n "$CI_COMMIT_TAG" ]; then
35-
SBOM_VERSION="${CI_COMMIT_TAG#v}";
36-
else
37-
SBOM_VERSION="0.0.0-${CI_COMMIT_SHORT_SHA}";
38-
fi
31+
## The package registry only accepts semantic versions, tags may carry a leading "v"
32+
- SBOM_VERSION="${CI_COMMIT_TAG#v}"
3933
## Scan the lock files only, vendor/ and node_modules/ are excluded to avoid
4034
## duplicate components and to keep the result reproducible
4135
- >
@@ -54,15 +48,6 @@ security:sbom:
5448
paths:
5549
- ${SBOM_FILE}
5650
expire_in: 1 year
51+
## Only released versions are documented, which matches the prod deployment being tag gated
5752
rules:
58-
- if: $CI_PIPELINE_SOURCE == "web"
59-
when: always
60-
- if: $CI_COMMIT_TAG =~ /^v?\d+\.\d+\.\d+$/
61-
when: always
62-
- if: $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "pipeline" || $CI_PIPELINE_SOURCE == "merge_request_event"
63-
when: never
64-
## Projects without release tags: manual SBOM on the default branch
65-
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
66-
when: manual
67-
allow_failure: true
68-
- when: never
53+
- if: '$CI_COMMIT_TAG =~ /^v?\d+\.\d+\.\d+$/'

0 commit comments

Comments
 (0)