From 36c9ae0f58cec8e6f09eaab88041c693592e2d0b Mon Sep 17 00:00:00 2001 From: "Nat Kershaw (MSFT)" Date: Tue, 9 May 2023 23:06:08 -0700 Subject: [PATCH] Fix release version suffix for RC builds (#15865) --- .../c-api-noopenmp-packaging-pipelines.yml | 35 ++++++++++--------- .../azure-pipelines/templates/c-api-cpu.yml | 13 +++---- ...device-training-cpu-packaging-pipeline.yml | 9 ++--- 3 files changed, 27 insertions(+), 30 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/c-api-noopenmp-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/c-api-noopenmp-packaging-pipelines.yml index c83290f7cb0ac..3e605f1c7e08e 100644 --- a/tools/ci_build/github/azure-pipelines/c-api-noopenmp-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/c-api-noopenmp-packaging-pipelines.yml @@ -28,9 +28,9 @@ parameters: displayName: Suffix added to pre-release package version. Only used if IsReleaseBuild is true. Denotes the type of pre-release package. type: string values: - - -alpha - - -beta - - -rc + - alpha + - beta + - rc - none default: none @@ -67,30 +67,32 @@ variables: value: '' stages: -- stage: Set_release_version_suffix +- stage: Setup jobs: - - job: + - job: Set_Variables steps: - checkout: none - bash: | if [[ "${{ parameters.IsReleaseBuild }}" = True && "${{ parameters.PreReleaseVersionSuffixString }}" != "none" ]]; then - echo "##vso[task.setvariable variable=ReleaseVersionSuffix; isoutput=true]${{ parameters.PreReleaseVersionSuffixString }}.${{ parameters.PreReleaseVersionSuffixNumber }}" + if [[ "${{ parameters.PreReleaseVersionSuffixNumber }}" -eq 0 ]]; then + echo "##vso[task.setvariable variable=ReleaseVersionSuffix;isOutput=true]-${{ parameters.PreReleaseVersionSuffixString }}" + else + echo "##vso[task.setvariable variable=ReleaseVersionSuffix;isOutput=true]-${{ parameters.PreReleaseVersionSuffixString }}.${{ parameters.PreReleaseVersionSuffixNumber }}" + fi else - echo "##vso[task.setvariable variable=ReleaseVersionSuffix; isoutput=true]''" + echo "##vso[task.setvariable variable=ReleaseVersionSuffix;isOutput=true]" fi - - bash: | - echo "IsReleaseBuild is: ${{ parameters.IsReleaseBuild }}" - echo "Pre-release version suffix is: ${{ parameters.PreReleaseVersionSuffixString }}" - echo "Pre-release version number is: ${{ parameters.PreReleaseVersionSuffixNumber }}" - echo "Release version suffix is: $(ReleaseVersionSuffix)" + name: Set_Release_Version_Suffix - stage: Debug + dependsOn: Setup jobs: - - job: + - job: D1 + variables: + MyVar: $[stageDependencies.Setup.Set_Variables.outputs['Set_Release_Version_Suffix.ReleaseVersionSuffix']] steps: - checkout: none - - bash: | - echo "Release version suffix is: $(ReleaseVersionSuffix)" + - bash: echo $(MyVar) - template: templates/c-api-cpu.yml parameters: @@ -98,7 +100,6 @@ stages: DoCompliance: ${{ parameters.DoCompliance }} DoEsrp: ${{ parameters.DoEsrp }} IsReleaseBuild: ${{ parameters.IsReleaseBuild }} - ReleaseVersionSuffix: $(ReleaseVersionSuffix) OrtNugetPackageId: 'Microsoft.ML.OnnxRuntime' AdditionalBuildFlags: '' AdditionalWinBuildFlags: '--enable_onnx_tests --enable_wcos' @@ -546,6 +547,7 @@ stages: - stage: NuGet_Packaging_GPU dependsOn: + - Setup - Windows_Packaging_gpu - Windows_Packaging_tensorrt - Linux_C_API_Packaging_GPU_x64 @@ -560,6 +562,7 @@ stages: pool: 'Azure-Pipelines-EO-Windows2022-aiinfra' variables: breakCodesignValidationInjection: ${{ parameters.DoEsrp }} + ReleaseVersionSuffix: $[stageDependencies.Setup.Set_Variables.outputs['Set_Release_Version_Suffix.ReleaseVersionSuffix']] steps: - checkout: self diff --git a/tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml b/tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml index d4577fdc1cf0f..6b79f2d33dc76 100644 --- a/tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml +++ b/tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml @@ -19,11 +19,6 @@ parameters: type: boolean default: false -- name: ReleaseVersionSuffix - displayName: Suffix added to release package name -alpha, -rc etc. - type: string - default: "" - - name: AdditionalBuildFlags displayName: Additional build flags for build.py type: string @@ -289,6 +284,7 @@ stages: - stage: NuGet_Packaging_CPU dependsOn: + - Setup - Linux_C_API_Packaging_CPU - MacOS_C_API_Packaging_CPU - Windows_Packaging_CPU_x86_${{ parameters.BuildVariant }} @@ -308,6 +304,7 @@ stages: variables: OrtPackageId: ${{ parameters.OrtNugetPackageId }} breakCodesignValidationInjection: ${{ parameters.DoEsrp }} + ReleaseVersionSuffix: $[stageDependencies.Setup.Set_Variables.outputs['Set_Release_Version_Suffix.ReleaseVersionSuffix']] steps: - checkout: self @@ -414,7 +411,7 @@ stages: # # 'Any CPU' is the default (first 'mixed' platform specified in the csproj) so this should be fine. script: | - dotnet build .\src\Microsoft.ML.OnnxRuntime\Microsoft.ML.OnnxRuntime.csproj -p:SelectedTargets=Net6 -p:Configuration=RelWithDebInfo -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=${{ parameters.ReleaseVersionSuffix }} + dotnet build .\src\Microsoft.ML.OnnxRuntime\Microsoft.ML.OnnxRuntime.csproj -p:SelectedTargets=Net6 -p:Configuration=RelWithDebInfo -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix) workingDirectory: '$(Build.SourcesDirectory)\csharp' - task: MSBuild@1 @@ -432,7 +429,7 @@ stages: solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln' platform: 'Any CPU' configuration: RelWithDebInfo - msbuildArguments: '-p:SelectedTargets=PreNet6 -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=${{ parameters.ReleaseVersionSuffix }}' + msbuildArguments: '-p:SelectedTargets=PreNet6 -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)' workingDirectory: '$(Build.SourcesDirectory)\csharp' - ${{ if eq(parameters.DoEsrp, true) }}: @@ -457,7 +454,7 @@ stages: solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj' platform: 'Any CPU' configuration: RelWithDebInfo - msbuildArguments: '-t:CreatePackage -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=${{ parameters.ReleaseVersionSuffix }}' + msbuildArguments: '-t:CreatePackage -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)' workingDirectory: '$(Build.SourcesDirectory)\csharp' - task: CopyFiles@2 diff --git a/tools/ci_build/github/azure-pipelines/templates/ondevice-training-cpu-packaging-pipeline.yml b/tools/ci_build/github/azure-pipelines/templates/ondevice-training-cpu-packaging-pipeline.yml index ef7934faebfe0..dcab3c83b1d05 100644 --- a/tools/ci_build/github/azure-pipelines/templates/ondevice-training-cpu-packaging-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/templates/ondevice-training-cpu-packaging-pipeline.yml @@ -19,11 +19,6 @@ parameters: type: boolean default: false -- name: ReleaseVersionSuffix - displayName: Suffix added to release package name -alpha, -rc etc. - type: string - default: "" - - name: AdditionalBuildFlags displayName: Additional build flags for build.py type: string @@ -131,6 +126,7 @@ stages: - stage: NuGet_Packaging_Training_CPU dependsOn: + - Setup - Linux_C_API_Packaging_Training_CPU - Windows_Packaging_Training_CPU_x86_${{ parameters.BuildVariant }} - Windows_Packaging_Training_CPU_x64_${{ parameters.BuildVariant }} @@ -148,6 +144,7 @@ stages: variables: OrtPackageId: ${{ parameters.OrtNugetPackageId }} breakCodesignValidationInjection: ${{ parameters.DoEsrp }} + ReleaseVersionSuffix: $[stageDependencies.Setup.Set_Variables.outputs['Set_Release_Version_Suffix.ReleaseVersionSuffix']] steps: - checkout: self @@ -243,7 +240,7 @@ stages: # # 'Any CPU' is the default (first 'mixed' platform specified in the csproj) so this should be fine. script: | - dotnet build .\src\Microsoft.ML.OnnxRuntime\Microsoft.ML.OnnxRuntime.csproj -p:SelectedTargets=Net6 -p:Configuration=RelWithDebInfo -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=${{ parameters.ReleaseVersionSuffix }} + dotnet build .\src\Microsoft.ML.OnnxRuntime\Microsoft.ML.OnnxRuntime.csproj -p:SelectedTargets=Net6 -p:Configuration=RelWithDebInfo -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix) workingDirectory: '$(Build.SourcesDirectory)\csharp' - task: MSBuild@1