-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathSbom.yml
70 lines (65 loc) · 2.59 KB
/
Sbom.yml
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
parameters:
- name: BuildDropPath
default: $(System.ArtifactsDirectory)
# Use the public repo URL, such as `https://github.com/powershell/powershell`
- name: Build_Repository_Uri
- name: displayName
default: SBOM
- name: SBOMGenerator_Formats
default: spdx:2.2
- name: PackageName
default: Unknown
- name: PackageVersion
default: '0.0.0'
- name: sourceScanPath
default: $(Build.SourcesDirectory)
- name: signSBOM
default: true
- name: dotNetVersion
default: 6.x
steps:
- task: UseDotNet@2
displayName: '${{ parameters.displayName }} - Install .NET ${{ parameters.dotNetVersion }}'
inputs:
version: ${{ parameters.dotNetVersion }}
- pwsh: |
Write-Verbose "$env:PACKAGENAME -eq 'Unknown'" -Verbose
if ($env:PACKAGENAME -eq 'Unknown') {
Write-Warning "PackageName is not set: $env:PACKAGENAME"
}
Write-Verbose "$env:PACKAGEVERSION -eq '0.0.0'" -Verbose
if ($env:PACKAGEVERSION -eq '0.0.0') {
Write-Warning "PackageVersion is not set: $env:PACKAGEVERSION"
}
displayName: '${{ parameters.displayName }} - Verify Parameters'
env:
PACKAGEVERSION: ${{ parameters.PackageVersion }}
PACKAGENAME: ${{ parameters.PackageName }}
- pwsh: |
Get-ChildItem env:
displayName: '${{ parameters.displayName }} - Capture Environment'
env:
Build.Repository.Uri: ${{ parameters.Build_Repository_Uri }}
BuildComponentPath: ${{ parameters.sourceScanPath }}
BuildDropPath: ${{ parameters.BuildDropPath }}
PackageName: ${{ parameters.PackageName }}
PackageVersion: ${{ parameters.PackageVersion }}
SBOMGenerator_Formats: '${{ parameters.SBOMGenerator_Formats }}'
sourceScanPath: ${{ parameters.sourceScanPath }}
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: '${{ parameters.displayName }} - Generate'
inputs:
BuildDropPath: ${{ parameters.BuildDropPath }}
PackageName: ${{ parameters.PackageName }}
PackageVersion: ${{ parameters.PackageVersion }}
BuildComponentPath: ${{ parameters.sourceScanPath }}
env:
SBOMGenerator_Formats: '${{ parameters.SBOMGenerator_Formats }}'
PACKAGING_ENABLESBOMSIGNING: '${{ parameters.signSBOM }}'
# *** Leaving these as documentation of the rest of the inputs ***
# These should be implemented as needed with backwards compatibility for user that didn't supply the parameters
#
# this is the folder to put the BOM, defaults to ${{ parameters.BuildDropPath }}
# ManifestDirPath: ${{ parameters.BuildDropPath }}
# configuration json for the tool
# ConfigFilePath: config.json