@@ -14,15 +14,24 @@ steps:
1414 TargetFolder : ${{ parameters.apiScanDirectory }}
1515 OverWrite : true
1616 flattenFolders : true
17- condition : and(succeeded(), eq(variables['runAPIScan'], 'true'), eq('refs/heads/${{ parameters.mainBranchName }}', variables['Build.SourceBranch']))
17+ condition : and(succeeded(), eq(variables['runAPIScan'], 'true'), ne('refs/heads/${{ parameters.mainBranchName }}', variables['Build.SourceBranch']))
18+
19+ - task : CmdLine@2
20+ displayName : ' Remove System assemblies from APIScan'
21+ inputs :
22+ script : |
23+ del ${{ parameters.apiScanDirectory }}\System.*
24+ del ${{ parameters.apiScanDirectory }}\mscorlib.dll
25+ del ${{ parameters.apiScanDirectory }}\netstandard.dll
26+ condition : and(succeeded(), eq(variables['runAPIScan'], 'true'), ne('refs/heads/${{ parameters.mainBranchName }}', variables['Build.SourceBranch']))
1827
1928- task : CmdLine@2
2029 displayName : ' List Files for APIScan'
2130 inputs :
2231 script : |
2332 tree ${{ parameters.apiScanDirectory }} /f
24- condition : and(succeeded(), eq(variables['runAPIScan'], 'true'), eq ('refs/heads/${{ parameters.mainBranchName }}', variables['Build.SourceBranch']))
25-
33+ condition : and(succeeded(), eq(variables['runAPIScan'], 'true'), ne ('refs/heads/${{ parameters.mainBranchName }}', variables['Build.SourceBranch']))
34+
2635 # ## Run latest version of APIScan listed at https://www.1eswiki.com/wiki/APIScan_Build_Task
2736- task : APIScan@2
2837 displayName : Run APIScan
@@ -32,6 +41,31 @@ steps:
3241 softwareVersionNum : ' $(Build.BuildId)'
3342 isLargeApp : true
3443 toolVersion : Latest
35- condition : and(succeeded(), eq(variables['runAPIScan'], 'true'), eq ('refs/heads/${{ parameters.mainBranchName }}', variables['Build.SourceBranch']))
44+ condition : and(succeeded(), eq(variables['runAPIScan'], 'true'), ne ('refs/heads/${{ parameters.mainBranchName }}', variables['Build.SourceBranch']))
3645 env :
3746 AzureServicesAuthConnectionString : runAs=App;AppId=$(ApiScanClientId);TenantId=$(ApiScanTenant);AppKey=$(ApiScanSecret)
47+
48+ - task : SdtReport@2
49+ displayName : Guardian Export - Security Report
50+ inputs :
51+ GdnExportAllTools : false
52+ GdnExportGdnToolApiScan : true
53+ GdnExportOutputSuppressionFile : source.gdnsuppress
54+ condition : and(eq(variables['runAPIScan'], 'true'), ne('refs/heads/${{ parameters.mainBranchName }}', variables['Build.SourceBranch']))
55+
56+ - task : PublishSecurityAnalysisLogs@3
57+ displayName : Publish Guardian Artifacts
58+ inputs :
59+ ArtifactName : APIScan Logs
60+ ArtifactType : Container
61+ AllTools : false
62+ APIScan : true
63+ ToolLogsNotFoundAction : Warning
64+ condition : and(eq(variables['runAPIScan'], 'true'), ne('refs/heads/${{ parameters.mainBranchName }}', variables['Build.SourceBranch']))
65+
66+ - task : PostAnalysis@2
67+ displayName : Fail Build on Guardian Issues
68+ inputs :
69+ GdnBreakAllTools : false
70+ GdnBreakGdnToolApiScan : true
71+ condition : and(eq(variables['runAPIScan'], 'true'), ne('refs/heads/${{ parameters.mainBranchName }}', variables['Build.SourceBranch']))
0 commit comments