Skip to content

Commit 7d99049

Browse files
committed
- Added MDS package version to AKV official build steps for Package mode.
- Moved Roslyn analysis above build steps to avoid Roslyn clobbering artifacts. - Removed obsolete code scanning.
1 parent 8b80680 commit 7d99049

File tree

8 files changed

+62
-56
lines changed

8 files changed

+62
-56
lines changed

eng/pipelines/akv-official-pipeline.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ extends:
105105
roslyn:
106106
enabled: ${{ parameters.runSdlTasks }}
107107
break: true
108-
# Requires RoslynAnalyzers task to be added after build task
108+
# Requires RoslynAnalyzers task to be added somewhere in
109+
# the build stage.
109110

110111
publishLogs:
111112
enabled: ${{ parameters.runSdlTasks }}

eng/pipelines/common/templates/jobs/build-signed-package-job.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,8 @@ jobs:
4949
configuration: $(Configuration)
5050
msbuildArguments: -t:BuildTools
5151

52-
# GOTCHA: This analysis step must run _before_ the build (below) step because
53-
# it builds DLLs that would otherwise clobber the properly-versioned DLLs from
54-
# the build step!
52+
# Perform analysis before building, since this step will clobber build output
5553
- template: ../steps/code-analyze-step.yml@self
56-
parameters:
57-
analyzeType: all
5854

5955
- template: ../steps/build-all-configurations-signed-dlls-step.yml@self
6056
parameters:

eng/pipelines/common/templates/steps/code-analyze-step.yml

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,30 @@
33
# The .NET Foundation licenses this file to you under the MIT license. #
44
# See the LICENSE file in the project root for more information. #
55
#################################################################################
6-
parameters:
7-
- name: analyzeType
8-
values:
9-
- roslyn
10-
- inspect
11-
- all
126

7+
# This template defines a step to run Roslyn Analyzers on the MDS project build.
8+
# It uses the RoslynAnalyzers@3 task from the Secure Development Team's SDL
9+
# extension:
10+
#
11+
# https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-mohanb/security-integration/guardian-wiki/sdl-azdo-extension/roslyn-analyzers-build-task
12+
#
13+
# GOTCHA: This step will clobber any existing build output. It should be run
14+
# _before_ any build steps that perform versioning or signing.
15+
16+
# @TODO: This can probably be made generic and pass in the command lines for msbuild
17+
# BUT, they should be kept separate by now as we rebuild build.proj in parallel, we won't
18+
# affect >1 project at a time.
19+
20+
parameters:
1321
- name: sourceRoot
1422
type: string
1523
default: $(REPOROOT)
1624

17-
- name: packageRefMdsVersion
18-
type: string
19-
default: ''
20-
21-
- name: product
22-
default: MDS
23-
values:
24-
- MDS
25-
- MSS
26-
2725
steps:
28-
- ${{ if or(eq(parameters.analyzeType, 'roslyn'), eq(parameters.analyzeType, 'all')) }}:
29-
- ${{ if eq(parameters.product, 'MDS') }}:
30-
- task: securedevelopmentteam.vss-secure-development-tools.build-task-roslynanalyzers.RoslynAnalyzers@3
31-
displayName: 'Guardian Dotnet Analyzers '
32-
inputs:
33-
msBuildVersion: 17.0
34-
msBuildArchitecture: x64
35-
setupCommandlinePicker: vs2022
36-
msBuildCommandline: 'msbuild ${{parameters.sourceRoot}}\build.proj -p:configuration=Release -p:GenerateNuget=false -p:BuildTools=false -p:SigningKeyPath=$(Agent.TempDirectory)\netfxKeypair.snk'
37-
38-
- ${{ if or(eq(parameters.analyzeType, 'inspect'), eq(parameters.analyzeType, 'all')) }}:
39-
- task: securedevelopmentteam.vss-secure-development-tools.build-task-codeinspector.CodeInspector@2
40-
displayName: 'Run Code Inspector'
26+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-roslynanalyzers.RoslynAnalyzers@3
27+
displayName: Roslyn Analyzers
4128
inputs:
42-
LogLevel: Error
29+
msBuildVersion: 17.0
30+
msBuildArchitecture: x64
31+
setupCommandlinePicker: vs2022
32+
msBuildCommandline: 'msbuild ${{parameters.sourceRoot}}\build.proj -p:configuration=Release -p:GenerateNuget=false -p:BuildTools=false -p:SigningKeyPath=$(Agent.TempDirectory)\netfxKeypair.snk'

eng/pipelines/jobs/build-akv-official-job.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#################################################################################
66

77
parameters:
8+
- name: akvAssemblyFileVersion
9+
type: string
10+
811
- name: akvPackageVersion
912
type: string
1013

@@ -13,9 +16,6 @@ parameters:
1316

1417
- name: apiScanPdbPath
1518
type: string
16-
17-
- name: assemblyFileVersion
18-
type: string
1919

2020
- name: buildConfiguration
2121
type: string
@@ -86,11 +86,20 @@ jobs:
8686
$jsonParams | ConvertFrom-Json | Format-List
8787
displayName: 'Output Job Parameters'
8888
89-
- template: ../steps/compound-build-akv-step.yml@self
89+
# Perform analysis before building, since this step will clobber build
90+
# output
91+
- template: ../steps/roslyn-analyzers-akv-step.yml@self
9092
parameters:
91-
assemblyFileVersion: '${{ parameters.assemblyFileVersion }}'
93+
akvPackageVersion: '${{ parameters.akvPackageVersion }}'
9294
buildConfiguration: '${{ parameters.buildConfiguration }}'
95+
mdsPackageVersion: '${{ parameters.mdsPackageVersion }}'
96+
97+
- template: ../steps/compound-build-akv-step.yml@self
98+
parameters:
99+
akvAssemblyFileVersion: '${{ parameters.akvAssemblyFileVersion }}'
93100
akvPackageVersion: '${{ parameters.akvPackageVersion }}'
101+
buildConfiguration: '${{ parameters.buildConfiguration }}'
102+
mdsPackageVersion: '${{ parameters.mdsPackageVersion }}'
94103

95104
- ${{ each targetFramework in parameters.targetFrameworks }}:
96105
- template: ../steps/compound-extract-akv-apiscan-files-step.yml
@@ -101,11 +110,6 @@ jobs:
101110
referenceType: Package
102111
targetFramework: '${{ targetFramework }}'
103112

104-
- template: ../steps/roslyn-analyzers-akv-step.yml@self
105-
parameters:
106-
buildConfiguration: '${{ parameters.buildConfiguration }}'
107-
akvPackageVersion: '${{ parameters.akvPackageVersion }}'
108-
109113
- template: ../steps/compound-esrp-code-signing-step.yml@self
110114
parameters:
111115
appRegistrationClientId: '${{ parameters.signingAppRegistrationClientId }}'

eng/pipelines/steps/compound-build-akv-step.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,18 @@
1010
# @TODO: mdsPackageVersion should not be used for MDS package version
1111

1212
parameters:
13-
- name: akvPackageVersion
13+
- name: akvAssemblyFileVersion
1414
type: string
1515

16-
- name: assemblyFileVersion
16+
- name: akvPackageVersion
1717
type: string
1818

1919
- name: buildConfiguration
2020
type: string
2121

22+
- name: mdsPackageVersion
23+
type: string
24+
2225
steps:
2326
- task: DownloadSecureFile@1
2427
displayName: 'Download Signing Key'
@@ -32,21 +35,16 @@ steps:
3235
packageType: 'sdk'
3336
version: '9.x'
3437

35-
- task: UseDotNet@2
36-
displayName: 'Install .NET 8.x Runtime'
37-
inputs:
38-
packageType: 'runtime'
39-
version: '8.x'
40-
4138
- task: MSBuild@1
4239
displayName: 'Build.proj - BuildAkv'
4340
inputs:
4441
solution: '$(REPO_ROOT)/build.proj'
4542
configuration: '${{ parameters.buildConfiguration }}'
4643
msbuildArguments: >-
4744
-t:BuildAkv
48-
-p:AssemblyFileVersion=${{ parameters.assemblyFileVersion }}
45+
-p:AssemblyFileVersion=${{ parameters.akvAssemblyFileVersion }}
4946
-p:AkvPackageVersion=${{ parameters.akvPackageVersion }}
47+
-p:MdsPackageVersion=${{ parameters.mdsPackageVersion }}
5048
-p:ReferenceType=Package
5149
-p:SigningKeyPath=$(Agent.TempDirectory)/netfxKeypair.snk
5250

eng/pipelines/steps/roslyn-analyzers-akv-step.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44
# See the LICENSE file in the project root for more information. #
55
#################################################################################
66

7+
# This template defines a step to run Roslyn Analyzers on the AKV project build.
8+
# It uses the RoslynAnalyzers@3 task from the Secure Development Team's SDL
9+
# extension:
10+
#
11+
# https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-mohanb/security-integration/guardian-wiki/sdl-azdo-extension/roslyn-analyzers-build-task
12+
#
13+
# GOTCHA: This step will clobber any existing build output. It should be run
14+
# _before_ any build steps that perform versioning or signing.
15+
716
# @TODO: This can probably be made generic and pass in the command lines for msbuild
817
# BUT, they should be kept separate by now as we rebuild build.proj in parallel, we won't
918
# affect >1 project at a time.
@@ -15,6 +24,9 @@ parameters:
1524
- name: buildConfiguration
1625
type: string
1726

27+
- name: mdsPackageVersion
28+
type: string
29+
1830
steps:
1931
- task: securedevelopmentteam.vss-secure-development-tools.build-task-roslynanalyzers.RoslynAnalyzers@3
2032
displayName: 'Roslyn Analyzers'
@@ -26,6 +38,7 @@ steps:
2638
-t:BuildAkv
2739
-p:Configuration=${{ parameters.buildConfiguration }}
2840
-p:AkvPackageVersion=${{ parameters.akvPackageVersion }}
41+
-p:MdsPackageVersion=${{ parameters.mdsPackageVersion }}
2942
-p:ReferenceType=Package
3043
msBuildVersion: 17.0
3144
setupCommandLinePicker: vs2022

eng/pipelines/variables/akv-official-variables.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ variables:
3535
value: '-preview1'
3636

3737
# Compound Variables ---------------------------------------------------
38-
- name: assemblyFileVersion
38+
- name: akvAssemblyFileVersion
3939
value: '${{ variables.versionMajor }}.${{ variables.versionMinor }}${{ variables.versionPatch }}.$(Build.BuildNumber)'
4040
- name: akvPackageVersion
4141
value: '${{ variables.versionMajor }}.${{ variables.versionMinor }}.${{ variables.versionPatch }}${{ variables.versionPreview }}'

tools/props/Versions.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
specific to MDS, and then used in the MDS project. As-is, these names are
3232
used by the build tooling and may be unintentionally included in other
3333
(non-MDS) projects.
34+
35+
For example, the AKV package uses the AssemblyVersion, FileVersion, and
36+
Version as its own. It currently isn't possible to build/package both
37+
MDS and AKV at the same time.
3438
-->
3539

3640
<!--

0 commit comments

Comments
 (0)