|
10 | 10 | - d16-*
|
11 | 11 | - d17-*
|
12 | 12 |
|
| 13 | +parameters: |
| 14 | +- name: ApiScanSourceBranch |
| 15 | + default: 'refs/heads/main' |
| 16 | + |
13 | 17 | # Global variables
|
14 | 18 | variables:
|
15 | 19 | - name: DotNetCoreVersion
|
|
66 | 70 | displayName: 'Build NuGet'
|
67 | 71 | condition: and(succeeded(), eq(variables['agent.os'], 'Windows_NT'))
|
68 | 72 |
|
| 73 | + - task: PublishPipelineArtifact@1 |
| 74 | + displayName: Upload Build Output |
| 75 | + inputs: |
| 76 | + path: bin/Debug |
| 77 | + artifactName: Output - $(System.JobName) |
| 78 | + |
69 | 79 | - task: PublishPipelineArtifact@1
|
70 | 80 | displayName: Upload Artifacts
|
71 | 81 | inputs:
|
72 | 82 | path: $(Build.ArtifactStagingDirectory)
|
73 |
| - artifactName: $(vmImage) |
| 83 | + artifactName: Artifacts - $(System.JobName) |
74 | 84 | condition: always()
|
| 85 | + |
| 86 | +- job: api_scan |
| 87 | + displayName: API Scan |
| 88 | + dependsOn: build |
| 89 | + condition: and(eq(dependencies.build.result, 'Succeeded'), eq(variables['Build.SourceBranch'], '${{ parameters.ApiScanSourceBranch }}')) |
| 90 | + pool: |
| 91 | + name: Azure Pipelines |
| 92 | + vmImage: windows-2022 |
| 93 | + timeoutInMinutes: 480 |
| 94 | + workspace: |
| 95 | + clean: all |
| 96 | + steps: |
| 97 | + - task: DownloadPipelineArtifact@2 |
| 98 | + displayName: Download build artifacts |
| 99 | + inputs: |
| 100 | + artifactName: Output - windows |
| 101 | + downloadPath: $(Build.SourcesDirectory) |
| 102 | + |
| 103 | + - task: CopyFiles@2 |
| 104 | + displayName: Collect Files for APIScan |
| 105 | + inputs: |
| 106 | + Contents: | |
| 107 | + $(Build.SourcesDirectory)\**\?(*.dll|*.exe|*.pdb) |
| 108 | + !$(Build.SourcesDirectory)\**\ls-jdks.* |
| 109 | + TargetFolder: $(Build.StagingDirectory)\apiscan |
| 110 | + OverWrite: true |
| 111 | + flattenFolders: true |
| 112 | + |
| 113 | + - powershell: Get-ChildItem -Path "$(Build.StagingDirectory)\apiscan" -Recurse |
| 114 | + displayName: List Files for APIScan |
| 115 | + |
| 116 | + - task: APIScan@2 |
| 117 | + displayName: Run APIScan |
| 118 | + inputs: |
| 119 | + softwareFolder: $(Build.StagingDirectory)\apiscan |
| 120 | + symbolsFolder: 'SRV*http://symweb;$(Build.StagingDirectory)\apiscan' |
| 121 | + softwareName: $(ApiScanName) |
| 122 | + softwareVersionNum: $(Build.SourceBranchName)-$(Build.SourceVersion)$(System.JobAttempt) |
| 123 | + isLargeApp: true |
| 124 | + toolVersion: Latest |
| 125 | + env: |
| 126 | + AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanClientId);TenantId=$(ApiScanTenant);AppKey=$(ApiScanSecret) |
| 127 | + |
| 128 | + - task: SdtReport@2 |
| 129 | + displayName: Guardian Export - Security Report |
| 130 | + inputs: |
| 131 | + GdnExportAllTools: false |
| 132 | + GdnExportGdnToolApiScan: true |
| 133 | + GdnExportOutputSuppressionFile: source.gdnsuppress |
| 134 | + |
| 135 | + - task: PublishSecurityAnalysisLogs@3 |
| 136 | + displayName: Publish Guardian Artifacts |
| 137 | + inputs: |
| 138 | + ArtifactName: APIScan Logs |
| 139 | + ArtifactType: Container |
| 140 | + AllTools: false |
| 141 | + APIScan: true |
| 142 | + ToolLogsNotFoundAction: Warning |
| 143 | + |
| 144 | + - task: PostAnalysis@2 |
| 145 | + displayName: Fail Build on Guardian Issues |
| 146 | + inputs: |
| 147 | + GdnBreakAllTools: false |
| 148 | + GdnBreakGdnToolApiScan: true |
0 commit comments