Skip to content

Commit 3535001

Browse files
authored
Revert "Update Guardian to latest (dotnet#10065)" (dotnet#10115)
This broke in main. This reverts commit 3439b16.
1 parent 87ef857 commit 3535001

File tree

5 files changed

+36
-91
lines changed

5 files changed

+36
-91
lines changed

eng/common/sdl/sdl.ps1

Lines changed: 0 additions & 37 deletions
This file was deleted.

eng/common/templates/job/execute-sdl.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ jobs:
3737
condition: eq( ${{ parameters.enable }}, 'true')
3838
variables:
3939
- group: DotNet-VSTS-Bot
40+
- name: AzDOProjectName
41+
value: ${{ parameters.AzDOProjectName }}
42+
- name: AzDOPipelineId
43+
value: ${{ parameters.AzDOPipelineId }}
44+
- name: AzDOBuildId
45+
value: ${{ parameters.AzDOBuildId }}
4046
- template: /eng/common/templates/variables/sdl-variables.yml
4147
- name: GuardianVersion
4248
value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }}

eng/common/templates/post-build/post-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@ stages:
236236
parameters:
237237
enable: ${{ parameters.SDLValidationParameters.enable }}
238238
additionalParameters: ${{ parameters.SDLValidationParameters.params }}
239-
sdlContinueOnError: ${{ parameters.SDLValidationParameters.continueOnError }}
239+
continueOnError: ${{ parameters.SDLValidationParameters.continueOnError }}
240240
artifactNames: ${{ parameters.SDLValidationParameters.artifactNames }}
241-
downloadArtifacts: ${{ coalesce(parameters.SDLValidationParameters.downloadArtifacts, 'false') }}
241+
downloadArtifacts: ${{ parameters.SDLValidationParameters.downloadArtifacts }}
242242

243243
- ${{ if ne(parameters.publishAssetsImmediately, 'true') }}:
244244
- stage: publish_using_darc

eng/common/templates/steps/execute-codeql.yml

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,24 @@
11
parameters:
22
# Language that should be analyzed. Defaults to csharp
3-
- name: language
4-
displayName: Analysis language
5-
type: string
6-
default: csharp
7-
3+
language: csharp
84
# Build Commands
9-
- name: buildCommands
10-
type: string
11-
default: ''
12-
13-
# Optional: to override values for parameters.
14-
- name: overrideParameters
15-
type: string
16-
default: ''
17-
18-
# Optional: parameters that need user specific values eg: '-SourceToolsList @("abc","def") -ArtifactToolsList @("ghi","jkl")'
19-
- name: additionalParameters
20-
type: string
21-
default: ''
22-
5+
buildCommands: ''
6+
overrideParameters: '' # Optional: to override values for parameters.
7+
additionalParameters: '' # Optional: parameters that need user specific values eg: '-SourceToolsList @("abc","def") -ArtifactToolsList @("ghi","jkl")'
238
# Optional: if specified, restore and use this version of Guardian instead of the default.
24-
- name: overrideGuardianVersion
25-
type: string
26-
default: ''
27-
9+
overrideGuardianVersion: ''
2810
# Optional: if true, publish the '.gdn' folder as a pipeline artifact. This can help with in-depth
2911
# diagnosis of problems with specific tool configurations.
30-
- name: publishGuardianDirectoryToPipeline
31-
type: boolean
32-
default: false
33-
12+
publishGuardianDirectoryToPipeline: false
3413
# The script to run to execute all SDL tools. Use this if you want to use a script to define SDL
3514
# parameters rather than relying on YAML. It may be better to use a local script, because you can
3615
# reproduce results locally without piecing together a command based on the YAML.
37-
- name: executeAllSdlToolsScript
38-
type: string
39-
default: 'eng/common/sdl/execute-all-sdl-tools.ps1'
40-
16+
executeAllSdlToolsScript: 'eng/common/sdl/execute-all-sdl-tools.ps1'
4117
# There is some sort of bug (has been reported) in Azure DevOps where if this parameter is named
4218
# 'continueOnError', the parameter value is not correctly picked up.
4319
# This can also be remedied by the caller (post-build.yml) if it does not use a nested parameter
4420
# optional: determines whether to continue the build if the step errors;
45-
- name: sdlContinueOnError
46-
type: boolean
47-
default: false
21+
sdlContinueOnError: false
4822

4923
steps:
5024
- template: /eng/common/templates/steps/execute-sdl.yml

eng/common/templates/steps/execute-sdl.yml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,29 @@ parameters:
88
condition: ''
99

1010
steps:
11+
- ${{ if ne(parameters.overrideGuardianVersion, '') }}:
12+
- powershell: |
13+
$content = Get-Content $(GuardianPackagesConfigFile)
1114
12-
- task: NuGetAuthenticate@1
13-
inputs:
14-
nuGetServiceConnections: GuardianConnect
15+
Write-Host "packages.config content was:`n$content"
1516
16-
- task: NuGetToolInstaller@1
17-
displayName: Install NuGet.exe
17+
$content = $content.Replace('$(DefaultGuardianVersion)', '$(GuardianVersion)')
18+
$content | Set-Content $(GuardianPackagesConfigFile)
1819
19-
- ${{ if ne(parameters.overrideGuardianVersion, '') }}:
20-
- pwsh: |
21-
. $(Build.SourcesDirectory)\eng\common\sdl\sdl.ps1
22-
$guardianCliLocation = Install-Gdn -Path $(Build.SourcesDirectory)\.artifacts -Version ${{ parameters.overrideGuardianVersion }}
23-
Write-Host "##vso[task.setvariable variable=GuardianCliLocation]$guardianCliLocation"
24-
displayName: Install Guardian (Overridden)
20+
Write-Host "packages.config content updated to:`n$content"
21+
displayName: Use overridden Guardian version ${{ parameters.overrideGuardianVersion }}
2522
26-
- ${{ if eq(parameters.overrideGuardianVersion, '') }}:
27-
- pwsh: |
28-
. $(Build.SourcesDirectory)\eng\common\sdl\sdl.ps1
29-
$guardianCliLocation = Install-Gdn -Path $(Build.SourcesDirectory)\.artifacts
30-
Write-Host "##vso[task.setvariable variable=GuardianCliLocation]$guardianCliLocation"
31-
displayName: Install Guardian
23+
- task: NuGetToolInstaller@1
24+
displayName: 'Install NuGet.exe'
25+
26+
- task: NuGetCommand@2
27+
displayName: 'Install Guardian'
28+
inputs:
29+
restoreSolution: $(Build.SourcesDirectory)\eng\common\sdl\packages.config
30+
feedsToUse: config
31+
nugetConfigPath: $(Build.SourcesDirectory)\eng\common\sdl\NuGet.config
32+
externalFeedCredentials: GuardianConnect
33+
restoreDirectory: $(Build.SourcesDirectory)\.packages
3234

3335
- ${{ if ne(parameters.overrideParameters, '') }}:
3436
- powershell: ${{ parameters.executeAllSdlToolsScript }} ${{ parameters.overrideParameters }}
@@ -38,7 +40,7 @@ steps:
3840

3941
- ${{ if eq(parameters.overrideParameters, '') }}:
4042
- powershell: ${{ parameters.executeAllSdlToolsScript }}
41-
-GuardianCliLocation $(GuardianCliLocation)
43+
-GuardianPackageName Microsoft.Guardian.Cli.$(GuardianVersion)
4244
-NugetPackageDirectory $(Build.SourcesDirectory)\.packages
4345
-AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw)
4446
${{ parameters.additionalParameters }}

0 commit comments

Comments
 (0)