@@ -55,47 +55,39 @@ extends:
55
55
value : ' $(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT'
56
56
- name : repoRoot
57
57
value : $(Build.SourcesDirectory)\OSS_Microsoft_PSSA
58
+ - name : ob_sdl_sbom_enabled
59
+ value : false
58
60
- name : ob_sdl_tsa_configFile
59
61
value : $(Build.SourcesDirectory)\OSS_Microsoft_PSSA\.config\tsaoptions.json
62
+ - name : signSrcPath
63
+ value : $(repoRoot)/out
60
64
pool :
61
65
type : windows
62
66
steps :
63
67
- checkout : self
64
- # make sure this happens before signing setup
65
- env :
66
- ob_restore_phase : true
67
68
68
69
- pwsh : |
69
70
if (-not (Test-Path $(repoRoot)/.config/tsaoptions.json)) {
70
71
Get-ChildItem $(Build.SourcesDirectory) -recurse -ErrorAction SilentlyContinue
71
- throw "tsaoptions.json does not exist under $(Build.SourcesDirectory)/OSS_Microsoft_PSSA /.config"
72
+ throw "tsaoptions.json does not exist under $(repoRoot) /.config"
72
73
}
73
74
displayName: Test if tsaoptions.json exists
74
- # make sure this happens before signing setup
75
- env:
76
- ob_restore_phase: true
77
75
76
+ # this is installing .NET
78
77
- pwsh : |
79
- Set-Location "$(Build.SourcesDirectory)/OSS_Microsoft_PSSA "
78
+ Set-Location "$(repoRoot) "
80
79
try { ./build.ps1 -Configuration Release -All } catch { throw $_ }
81
80
displayName: Execute build
82
- # make sure this happens before signing setup
83
- env:
84
- ob_restore_phase: true
85
81
86
82
- pwsh : |
87
- $signSrcPath = "$(Build.SourcesDirectory)/OSS_Microsoft_PSSA/out"
88
- # Set signing src path variable
89
- $vstsCommandString = "vso[task.setvariable variable=signSrcPath]${signSrcPath}"
90
- Write-Host "sending $vstsCommandString"
91
- Write-Host "##$vstsCommandString"
92
- $signOutStep1 = "$(Build.SourcesDirectory)/OSS_Microsoft_PSSA/Step1"
83
+ $signSrcPath = $env:SIGNSRCPATH
84
+ $signOutStep1 = "$(repoRoot)/Step1"
93
85
$null = New-Item -ItemType Directory -Path $signOutStep1
94
86
# Set signing out path variable
95
87
$vstsCommandString = "vso[task.setvariable variable=signOutStep1]${signOutStep1}"
96
88
Write-Host "sending $vstsCommandString"
97
89
Write-Host "##$vstsCommandString"
98
- $signOutPath = "$(Build.SourcesDirectory)/OSS_Microsoft_PSSA /signed"
90
+ $signOutPath = "$(repoRoot) /signed"
99
91
$null = New-Item -ItemType Directory -Path $signOutPath
100
92
# Set signing out path variable
101
93
$vstsCommandString = "vso[task.setvariable variable=signOutPath]${signOutPath}"
@@ -106,17 +98,53 @@ extends:
106
98
Write-Host "sending $vstsCommandString"
107
99
Write-Host "##$vstsCommandString"
108
100
# Get version and create a variable
109
- $moduleData = Import-PowerShellDataFile "$(Build.SourcesDirectory)/OSS_Microsoft_PSSA /Engine/PSScriptAnalyzer.psd1"
101
+ $moduleData = Import-PowerShellDataFile "$(repoRoot) /Engine/PSScriptAnalyzer.psd1"
110
102
$moduleVersion = $moduleData.ModuleVersion
111
103
$vstsCommandString = "vso[task.setvariable variable=moduleVersion]${moduleVersion}"
112
104
$vstsCommandString = "vso[task.setvariable variable=ob_sdl_sbom_packageversion]${moduleVersion}"
113
105
114
106
Write-Host "sending $vstsCommandString"
115
107
Write-Host "##$vstsCommandString"
116
108
displayName: Setup variables for signing
117
- # make sure this happens before signing setup
118
- env:
119
- ob_restore_phase: true
109
+
110
+ - task : CopyFiles@2
111
+ displayName : " Copy Files for 'publish build directory' publish task"
112
+ inputs :
113
+ SourceFolder : " $(signSrcPath)"
114
+ Contents : ' **'
115
+ TargetFolder : $(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT
116
+
117
+ - job : jobsign
118
+ dependsOn : jobbuild
119
+ displayName : Sign Microsoft.PowerShell.ScriptAnalyzer Files
120
+ variables :
121
+ - name : ob_outputDirectory
122
+ value : ' $(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT'
123
+ - name : repoRoot
124
+ value : $(Build.SourcesDirectory)\OSS_Microsoft_PSSA
125
+ - name : ob_sdl_tsa_configFile
126
+ value : $(Build.SourcesDirectory)\OSS_Microsoft_PSSA\.config\tsaoptions.json
127
+ - name : ob_sdl_sbom_enabled
128
+ value : true
129
+ - name : ob_sdl_codeql_compiled_enabled
130
+ value : false
131
+ - name : signSrcPath
132
+ value : $(repoRoot)/out
133
+ pool :
134
+ type : windows
135
+ steps :
136
+ - checkout : self
137
+
138
+ - task : DownloadPipelineArtifact@2
139
+ displayName : ' Download build files'
140
+ inputs :
141
+ targetPath : $(signSrcPath)
142
+ artifact : drop_stagebuild_jobbuild
143
+
144
+ - pwsh : |
145
+ Set-Location "$(signSrcPath)"
146
+ dir -recurse *
147
+ displayName: Capture artifacts
120
148
121
149
- task : onebranch.pipeline.signing@1
122
150
displayName : Sign 1st party files
@@ -137,12 +165,12 @@ extends:
137
165
- task : CopyFiles@2
138
166
displayName : " Copy Files for 'publish build directory' publish task"
139
167
inputs :
140
- SourceFolder : " $(Build.SourcesDirectory)/OSS_Microsoft_PSSA "
168
+ SourceFolder : " $(signSrcPath) "
141
169
Contents : ' **'
142
170
TargetFolder : $(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT
143
171
144
172
- job : nupkg
145
- dependsOn : jobbuild
173
+ dependsOn : jobsign
146
174
displayName : Package Microsoft.PowerShell.ScriptAnalyzer
147
175
variables :
148
176
- name : ob_outputDirectory
@@ -155,6 +183,8 @@ extends:
155
183
value : false
156
184
- name : ob_sdl_codeql_compiled_enabled
157
185
value : false
186
+ - name : signSrcPath
187
+ value : $(repoRoot)/out
158
188
pool :
159
189
type : windows
160
190
steps :
@@ -163,22 +193,23 @@ extends:
163
193
- pwsh : |
164
194
if (-not (Test-Path $(repoRoot)/.config/tsaoptions.json)) {
165
195
Get-ChildItem $(Build.SourcesDirectory) -recurse -ErrorAction SilentlyContinue
166
- throw "tsaoptions.json does not exist under $(Build.SourcesDirectory)/OSS_Microsoft_PSSA /.config"
196
+ throw "tsaoptions.json does not exist under $(repoRoot) /.config"
167
197
}
168
198
displayName: Test if tsaoptions.json exists
169
199
170
200
- task : DownloadPipelineArtifact@2
171
201
displayName : ' Download build files'
172
202
inputs :
173
- targetPath : $(Build.SourcesDirectory)/artifacts/build
203
+ targetPath : $(signSrcPath)
204
+ artifact : drop_stagebuild_jobsign
174
205
# # download
175
206
- pwsh : |
176
- Set-Location "$(Build.SourcesDirectory)/artifacts/ "
207
+ Set-Location "$(signSrcPath) "
177
208
dir -recurse *
178
209
displayName: Capture artifacts
179
210
180
211
- pwsh : |
181
- Set-Location "$(Build.SourcesDirectory)/artifacts/build "
212
+ Set-Location "$(repoRoot) "
182
213
./build -BuildNupkg -CopyManifest -signed
183
214
displayName: Create nupkg for publishing
184
215
0 commit comments