-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathgenerate-sbom.yml
More file actions
51 lines (48 loc) · 1.67 KB
/
Copy pathgenerate-sbom.yml
File metadata and controls
51 lines (48 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
# SBOM Generation Template
#
# Generates Software Bill of Materials (SBOM) using CycloneDX cdxgen and uploads to Dependency Track for security vulnerability tracking.
parameters:
- name: productGroup
type: string
- name: productName
type: string
- name: baseUrl
type: string
- name: apiKey
type: string
- name: majorVersion
type: string
steps:
- script: |
# Verify Dependency Track configuration
MISSING=""
if [ -z "${{ parameters.baseUrl }}" ]; then
echo "##vso[task.logissue type=error]Dependency Track base URL is not configured"
MISSING="true"
fi
if [ -z "${{ parameters.apiKey }}" ]; then
echo "##vso[task.logissue type=error]Dependency Track API key is not configured"
MISSING="true"
fi
if [ -n "$MISSING" ]; then
echo "##vso[task.complete result=Skipped;]Skipping SBOM generation - missing required configuration variables"
exit 0
fi
# Generate and upload SBOM
mkdir -p $(Build.ArtifactStagingDirectory)/sbom
npx @cyclonedx/cdxgen --recurse \
--output $(Build.ArtifactStagingDirectory)/sbom/sbom.json \
--spec-version 1.6 \
--json-pretty \
--project-group "${{ parameters.productGroup }}" \
--project-name "${{ parameters.productName }}" \
--project-version "v${{ parameters.majorVersion }}" \
--server-url "${{ parameters.baseUrl }}" \
--api-key "${{ parameters.apiKey }}"
displayName: 'Generate and upload SBOM'
- task: PublishPipelineArtifact@1
displayName: 'Publish SBOM artifact'
inputs:
targetPath: $(Build.ArtifactStagingDirectory)/sbom
artifactName: sbom