-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Move ApiScan to compliance build #18191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
TravisEz13
merged 10 commits into
PowerShell:master
from
TravisEz13:compliance-apiscan-gh
Sep 30, 2022
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
fbdf809
Add build and APIScan to compliance build
TravisEz13 dee6175
dynamically set version
TravisEz13 9924bc5
publish logs
TravisEz13 ba88624
set to standard verbosity
TravisEz13 f1381a5
add guardian export
TravisEz13 f70ebad
Download symbols
TravisEz13 05d42eb
Create configuration that doesn't make it ready to run
TravisEz13 5d7ac68
temp files are huge, don't preserve
TravisEz13 3ac3c2e
remove APIScan from release build
TravisEz13 d07b3e9
remove duplicate install tool task
TravisEz13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
tools/releaseBuild/azureDevOps/templates/compliance/apiscan.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| jobs: | ||
| - job: APIScan | ||
| variables: | ||
| - name: runCodesignValidationInjection | ||
| value : false | ||
| - name: NugetSecurityAnalysisWarningLevel | ||
| value: none | ||
| - name: ReleaseTagVar | ||
| value: fromBranch | ||
| # Defines the variables APIScanClient, APIScanTenant and APIScanSecret | ||
| - group: PS-PS-APIScan | ||
| # PAT permissions NOTE: Declare a SymbolServerPAT variable in this group with a 'microsoft' organizanization scoped PAT with 'Symbols' Read permission. | ||
| # A PAT in the wrong org will give a single Error 203. No PAT will give a single Error 401, and individual pdbs may be missing even if permissions are correct. | ||
| - group: symbols | ||
|
|
||
| pool: | ||
| name: PowerShell1ES | ||
| demands: | ||
| - ImageOverride -equals PSMMS2019-Secure | ||
|
|
||
| # APIScan can take a long time | ||
| timeoutInMinutes: 180 | ||
|
|
||
| steps: | ||
| - template: ../SetVersionVariables.yml | ||
| parameters: | ||
| ReleaseTagVar: $(ReleaseTagVar) | ||
| CreateJson: yes | ||
| UseJson: no | ||
|
|
||
| - pwsh: | | ||
| Import-Module .\build.psm1 -force | ||
| Start-PSBootstrap | ||
| workingDirectory: '$(Build.SourcesDirectory)' | ||
| retryCountOnTaskFailure: 2 | ||
| displayName: 'Bootstrap' | ||
|
|
||
| - pwsh: | | ||
| Import-Module .\build.psm1 -force | ||
| Find-DotNet | ||
| dotnet tool install dotnet-symbol --tool-path $(Agent.ToolsDirectory)\tools\dotnet-symbol | ||
| $symbolToolPath = Get-ChildItem -Path $(Agent.ToolsDirectory)\tools\dotnet-symbol\dotnet-symbol.exe | Select-Object -First 1 -ExpandProperty FullName | ||
| Write-Host "##vso[task.setvariable variable=symbolToolPath]$symbolToolPath" | ||
| displayName: Install dotnet-symbol | ||
| retryCountOnTaskFailure: 2 | ||
|
|
||
| - pwsh: | | ||
| Import-Module .\build.psm1 -force | ||
| Find-DotNet | ||
| Start-PSBuild -Configuration StaticAnalysis -PSModuleRestore -Clean | ||
|
|
||
| $OutputFolder = Split-Path (Get-PSOutput) | ||
| Write-Host "##vso[task.setvariable variable=BinDir]$OutputFolder" | ||
| workingDirectory: '$(Build.SourcesDirectory)' | ||
| displayName: 'Build PowerShell Source' | ||
|
|
||
| - pwsh: | | ||
| Get-ChildItem -Path env: | ||
| displayName: Capture Environment | ||
| condition: succeededOrFailed() | ||
|
|
||
| # Explicitly download symbols for the drop since the SDL image doesn't have http://SymWeb access and APIScan cannot handle https yet. | ||
| - pwsh: | | ||
| Import-Module .\build.psm1 -force | ||
| Find-DotNet | ||
| $pat = '$(SymbolServerPAT)' | ||
| if ($pat -like '*PAT*' -or $pat -eq '') | ||
| { | ||
| throw 'No PAT defined' | ||
| } | ||
| $url = 'https://microsoft.artifacts.visualstudio.com/defaultcollection/_apis/symbol/symsrv' | ||
| $(symbolToolPath) --authenticated-server-path $(SymbolServerPAT) $url --symbols -d "$env:BinDir\*" --recurse-subdirectories | ||
| displayName: 'Download Symbols for binaries' | ||
| retryCountOnTaskFailure: 2 | ||
| workingDirectory: '$(Build.SourcesDirectory)' | ||
|
|
||
| - task: securedevelopmentteam.vss-secure-development-tools.build-task-apiscan.APIScan@2 | ||
| displayName: 'Run APIScan' | ||
| inputs: | ||
| softwareFolder: '$(BinDir)' | ||
| softwareName: PowerShell | ||
| softwareVersionNum: '$(ReleaseTagVar)' | ||
| isLargeApp: false | ||
| preserveTempFiles: false | ||
| verbosityLevel: standard | ||
| # write a status update every 5 minutes. Default is 1 minute | ||
| statusUpdateInterval: '00:05:00' | ||
| env: | ||
| AzureServicesAuthConnectionString: RunAs=App;AppId=$(APIScanClient);TenantId=$(APIScanTenant);AppKey=$(APIScanSecret) | ||
|
|
||
| - task: securedevelopmentteam.vss-secure-development-tools.build-task-report.SdtReport@2 | ||
| continueOnError: true | ||
| displayName: 'Guardian Export' | ||
| inputs: | ||
| GdnExportVstsConsole: true | ||
| GdnExportSarifFile: true | ||
| GdnExportHtmlFile: true | ||
| GdnExportAllTools: false | ||
| GdnExportGdnToolApiScan: true | ||
| #this didn't do anything GdnExportCustomLogsFolder: '$(Build.ArtifactStagingDirectory)/Guardian' | ||
|
|
||
| - pwsh: | | ||
| Get-ChildItem -Path env: | ||
| displayName: Capture Environment | ||
| condition: succeededOrFailed() | ||
|
|
||
| - task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@3 | ||
| displayName: 'Publish Guardian Artifacts' | ||
| inputs: | ||
| AllTools: false | ||
| APIScan: true | ||
| ArtifactName: APIScan |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the code coverage configuration