Skip to content

Commit 9e5040e

Browse files
authored
Allow the user to set the package version when running the azdo pipeline (#8151)
* Allow the user to set the package version when running the azdo pipeline * Default value for a string param can't be empty string * pass ptvsPackageVersion into build template * Give package version a default value in the build template to avoid breaking other callers * Fix syntax error
1 parent dbac8cc commit 9e5040e

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

Build/debugpy-version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.8.11
1+
1.8.12

Build/templates/build.yml

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
parameters:
2+
- name: ptvsPackageVersion
3+
type: string
4+
default: $(Build.BuildNumber)
5+
16
steps:
27

38
# Build the product
@@ -8,7 +13,9 @@ steps:
813
msbuildVersion: $(MsBuildVersion)
914
platform: $(Platform)
1015
configuration: $(BuildConfiguration)
11-
msbuildArguments: '/p:VSTarget=$(VSTarget) /bl:$(Build.SourcesDirectory)\logs\BuildProduct.binlog'
16+
msbuildArguments: ' /p:VSTarget=$(VSTarget)
17+
/p:BuildNumber=${{ parameters.ptvsPackageVersion }}
18+
/bl:$(Build.SourcesDirectory)\logs\BuildProduct.binlog'
1219

1320
# The publish SBOM tasks have been removed because they are generated and published automatically by the pipeline
1421
# https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-pipeline-templates/features/sbom
@@ -33,7 +40,9 @@ steps:
3340
msbuildVersion: $(MsBuildVersion)
3441
platform: $(Platform)
3542
configuration: $(BuildConfiguration)
36-
msbuildArguments: '/p:VSTarget=$(VSTarget) /bl:$(Build.SourcesDirectory)\logs\BuildTests.binlog'
43+
msbuildArguments: ' /p:VSTarget=$(VSTarget)
44+
/p:BuildNumber=${{ parameters.ptvsPackageVersion }}
45+
/bl:$(Build.SourcesDirectory)\logs\BuildTests.binlog'
3746

3847
# Build the installer
3948
- task: MSBuild@1
@@ -45,6 +54,7 @@ steps:
4554
configuration: $(BuildConfiguration)
4655
msbuildArguments: ' /p:SkipProduct=true
4756
/p:VSTarget=$(VSTarget)
57+
/p:BuildNumber=${{ parameters.ptvsPackageVersion }}
4858
/p:BUILD_BINARIESDIRECTORY=$(Build.BinariesDirectory)
4959
/p:BUILD_STAGINGDIRECTORY=$(Build.StagingDirectory)
5060
/bl:$(Build.SourcesDirectory)\logs\BuildInstaller.binlog'

azure-pipelines.yml

+21
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,33 @@
44
# The pipeline extends v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates from 1esPipelines repository defined in resources section.
55

66
parameters:
7+
78
- name: pylanceVersion
89
displayName: Pylance Version
910
type: string
1011
default: latest
12+
1113
- name: pylanceReleaseType
1214
displayName: Pylance Release Type
1315
type: string
1416
default: stable
1517
values:
1618
- stable
1719
- preview
20+
1821
- name: debugpyVersion
1922
displayName: Debugpy Version
2023
type: string
2124
default: latest
25+
26+
# This is the version that the PTVS package currently being built will have.
27+
# If this value is set to 'currentBuildNumber' will default to $(Build.BuildNumber).
28+
# But this parameter can be used to overwrite the version number if needed.
29+
- name: ptvsPackageVersion
30+
displayName: PTVS Package Version
31+
type: string
32+
default: currentBuildNumber
33+
2234
- name: skipGlassCache
2335
displayName: Skip Glass Cache
2436
type: boolean
@@ -92,6 +104,13 @@ variables:
92104
${{ else }}:
93105
value: ${{ parameters.pylanceReleaseType }}
94106

107+
# If the vs package version is not specified, use the build number
108+
- name: ptvsPackageVersionVar
109+
${{ if eq(parameters.ptvsPackageVersion, 'currentBuildNumber') }}:
110+
value: $(Build.BuildNumber)
111+
${{ else }}:
112+
value: ${{ parameters.ptvsPackageVersion }}
113+
95114
# Import variables from PTVS-Dev17 variable group
96115
- group: PTVS-Dev17
97116

@@ -185,6 +204,8 @@ extends:
185204

186205
# Build and publish logs
187206
- template: /Build/templates/build.yml@self
207+
parameters:
208+
ptvsPackageVersion: ${{ variables.ptvsPackageVersionVar }}
188209

189210
# Non-PR steps
190211
- ${{ if notin(variables['Build.Reason'], 'PullRequest') }}:

0 commit comments

Comments
 (0)