Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit adc971f

Browse files
committed
(#624) Added required scc checks for compliance
1 parent 8c10d88 commit adc971f

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.azure-pipelines/main.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ pool:
1212
variables:
1313
basePath: 'src/APIM_ARMTemplate'
1414
configuration: 'Release'
15+
BASE_VERSION: '0.0.1'
16+
PREVIEW_LABEL: 'preview'
17+
BUILD_NUMBER: $[counter(format('{0}_{1}_{2}', variables['BASE_VERSION'], variables['PREVIEW_LABEL'], variables['Build.SourceBranch']), 1)]
18+
APP_VERSION: $[format('{0}-{1}.{2}', variables['BASE_VERSION'], variables['PREVIEW_LABEL'], variables['BUILD_NUMBER'])]
1519

1620
stages:
1721
- stage: build
@@ -25,6 +29,27 @@ stages:
2529
version: '3.1.x'
2630
performMultiLevelLookup: true
2731

32+
- pwsh: |
33+
$pr = "pr." + $env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER
34+
$version = $env:BASE_VERSION + "-" + $pr + "." + $env:BUILD_NUMBER
35+
Write-Host "Preview label: $pr"
36+
Write-Host "NuGet version: $nuget"
37+
Write-Host "##vso[task.setvariable variable=PREVIEW_LABEL]$pr"
38+
Write-Host "##vso[task.setvariable variable=APP_VERSION]$version"
39+
displayName: Override version for PRs
40+
condition: eq(variables['Build.Reason'], 'PullRequest')
41+
42+
- pwsh: |
43+
$tagVersion = $env:BUILD_SOURCEBRANCHNAME
44+
Write-Host "Tag version: $tagVersion"
45+
Write-Host "##vso[task.setvariable variable=APP_VERSION]$tagVersion"
46+
displayName: Override version for tags
47+
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
48+
49+
- pwsh: |
50+
Write-Host "##vso[build.updatebuildnumber]$env:APP_VERSION"
51+
displayName: Update the build number with a more readable one
52+
2853
- task: DotNetCoreCLI@2
2954
displayName: 'Build Toolkit'
3055
inputs:
@@ -49,3 +74,50 @@ stages:
4974
inputs:
5075
pathToPublish: '$(basePath)/apimtemplate/bin/$(configuration)'
5176
artifactName: build
77+
78+
- stage: postbuild
79+
displayName: 'Post Build Checks'
80+
condition: eq('ref/heads/main', variables['Build.SourceBranch'])
81+
dependsOn: ['build']
82+
jobs:
83+
- job: required_checks
84+
displayName: 'Run required code checks'
85+
steps:
86+
- pwsh: |
87+
$repo = "$(Build.Repository.Id)"
88+
$repo = $repo.Substring($repo.IndexOf("/") + 1)
89+
$branch = "main"
90+
$CODEBASE_NAME = $repo + "_" + $branch
91+
echo "Using codebase: $CODEBASE_NAME"
92+
Write-Host "##vso[task.setvariable variable=CODEBASE_NAME]$CODEBASENAME"
93+
94+
- task: CredScan@2
95+
inputs:
96+
toolMajorVersion: 'V2'
97+
98+
- task: PoliCheck@1
99+
inputs:
100+
inputType: 'Basic'
101+
targetType: 'F'
102+
103+
- task: SdtReport@1
104+
displayName: 'Create security analysis report'
105+
inputs:
106+
AllTools: false
107+
APIScan: false
108+
BinSkim: false
109+
CodesignValidation: false
110+
CredScan: true
111+
FortifySCA: false
112+
FxCop: false
113+
ModernCop: false
114+
MSRD: false
115+
PoliCheck: true
116+
RoslynAnalyzers: false
117+
SDLNativeRules: false
118+
Semmle: false
119+
TSLint: false
120+
ToolLogsNotFoundAction: 'Standard'
121+
122+
- task: PublishSecurityAnalysisLogs@3
123+
displayName: 'Publish security analysis logs'

0 commit comments

Comments
 (0)