|
43 | 43 | value: ${{ parameters.AzDOPipelineId }} |
44 | 44 | - name: AzDOBuildId |
45 | 45 | value: ${{ parameters.AzDOBuildId }} |
46 | | - # The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in |
47 | | - # sync with the packages.config file. |
48 | | - - name: DefaultGuardianVersion |
49 | | - value: 0.110.1 |
| 46 | + - template: /eng/common/templates/variables/sdl-variables.yml |
50 | 47 | - name: GuardianVersion |
51 | 48 | value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }} |
52 | | - - name: GuardianPackagesConfigFile |
53 | | - value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config |
54 | 49 | pool: |
55 | 50 | # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) |
56 | 51 | ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: |
@@ -126,57 +121,11 @@ jobs: |
126 | 121 | displayName: Extract Archive Artifacts |
127 | 122 | continueOnError: ${{ parameters.sdlContinueOnError }} |
128 | 123 |
|
129 | | - - ${{ if ne(parameters.overrideGuardianVersion, '') }}: |
130 | | - - powershell: | |
131 | | - $content = Get-Content $(GuardianPackagesConfigFile) |
132 | | -
|
133 | | - Write-Host "packages.config content was:`n$content" |
134 | | -
|
135 | | - $content = $content.Replace('$(DefaultGuardianVersion)', '$(GuardianVersion)') |
136 | | - $content | Set-Content $(GuardianPackagesConfigFile) |
137 | | -
|
138 | | - Write-Host "packages.config content updated to:`n$content" |
139 | | - displayName: Use overridden Guardian version ${{ parameters.overrideGuardianVersion }} |
140 | | -
|
141 | | - - task: NuGetToolInstaller@1 |
142 | | - displayName: 'Install NuGet.exe' |
143 | | - - task: NuGetCommand@2 |
144 | | - displayName: 'Install Guardian' |
145 | | - inputs: |
146 | | - restoreSolution: $(Build.SourcesDirectory)\eng\common\sdl\packages.config |
147 | | - feedsToUse: config |
148 | | - nugetConfigPath: $(Build.SourcesDirectory)\eng\common\sdl\NuGet.config |
149 | | - externalFeedCredentials: GuardianConnect |
150 | | - restoreDirectory: $(Build.SourcesDirectory)\.packages |
151 | | - |
152 | | - - ${{ if ne(parameters.overrideParameters, '') }}: |
153 | | - - powershell: ${{ parameters.executeAllSdlToolsScript }} ${{ parameters.overrideParameters }} |
154 | | - displayName: Execute SDL |
155 | | - continueOnError: ${{ parameters.sdlContinueOnError }} |
156 | | - - ${{ if eq(parameters.overrideParameters, '') }}: |
157 | | - - powershell: ${{ parameters.executeAllSdlToolsScript }} |
158 | | - -GuardianPackageName Microsoft.Guardian.Cli.$(GuardianVersion) |
159 | | - -NugetPackageDirectory $(Build.SourcesDirectory)\.packages |
160 | | - -AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw) |
161 | | - ${{ parameters.additionalParameters }} |
162 | | - displayName: Execute SDL |
163 | | - continueOnError: ${{ parameters.sdlContinueOnError }} |
164 | | - |
165 | | - - ${{ if ne(parameters.publishGuardianDirectoryToPipeline, 'false') }}: |
166 | | - # We want to publish the Guardian results and configuration for easy diagnosis. However, the |
167 | | - # '.gdn' dir is a mix of configuration, results, extracted dependencies, and Guardian default |
168 | | - # tooling files. Some of these files are large and aren't useful during an investigation, so |
169 | | - # exclude them by simply deleting them before publishing. (As of writing, there is no documented |
170 | | - # way to selectively exclude a dir from the pipeline artifact publish task.) |
171 | | - - task: DeleteFiles@1 |
172 | | - displayName: Delete Guardian dependencies to avoid uploading |
173 | | - inputs: |
174 | | - SourceFolder: $(Agent.BuildDirectory)/.gdn |
175 | | - Contents: | |
176 | | - c |
177 | | - i |
178 | | - condition: succeededOrFailed() |
179 | | - - publish: $(Agent.BuildDirectory)/.gdn |
180 | | - artifact: GuardianConfiguration |
181 | | - displayName: Publish GuardianConfiguration |
182 | | - condition: succeededOrFailed() |
| 124 | + - template: /eng/common/templates/steps/execute-sdl.yml |
| 125 | + parameters: |
| 126 | + overrideGuardianVersion: ${{ parameters.overrideGuardianVersion }} |
| 127 | + executeAllSdlToolsScript: ${{ parameters.executeAllSdlToolsScript }} |
| 128 | + overrideParameters: ${{ parameters.overrideParameters }} |
| 129 | + additionalParameters: ${{ parameters.additionalParameters }} |
| 130 | + publishGuardianDirectoryToPipeline: ${{ parameters.publishGuardianDirectoryToPipeline }} |
| 131 | + sdlContinueOnError: ${{ parameters.sdlContinueOnError }} |
0 commit comments