From 7aca6347eb5ed10311ca04705bd2cc86144a6b6d Mon Sep 17 00:00:00 2001 From: Jian Chen Date: Thu, 6 Feb 2025 16:32:53 -0800 Subject: [PATCH] Move set common variable to stage --- .../mac-ios-packaging-pipeline.yml | 41 ------------------- .../stages/mac-ios-packaging-build-stage.yml | 33 ++++++++++++++- 2 files changed, 31 insertions(+), 43 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/mac-ios-packaging-pipeline.yml b/tools/ci_build/github/azure-pipelines/mac-ios-packaging-pipeline.yml index bdbd2ffe00..acdd3d070b 100644 --- a/tools/ci_build/github/azure-pipelines/mac-ios-packaging-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/mac-ios-packaging-pipeline.yml @@ -63,47 +63,6 @@ extends: name: onnxruntime-Win-CPU-2022 os: windows stages: - - stage: IosPackaging_SetCommonVariables - dependsOn: [] - - variables: - skipComponentGovernanceDetection: true - - jobs: - - job: SetCommonVariables - displayName: "Set common variables" - timeoutInMinutes: 5 - steps: - - bash: | - set -e - - BUILD_TYPE="${{ parameters.buildType }}" - BASE_VERSION="$(cat ./VERSION_NUMBER)" - SHORT_COMMIT_HASH="$(git rev-parse --short HEAD)" - DEV_VERSION="${BASE_VERSION}-dev+$(Build.BuildNumber).${SHORT_COMMIT_HASH}" - - case "${BUILD_TYPE}" in - ("release") - VERSION="${BASE_VERSION}" ;; - ("normal") - VERSION="${DEV_VERSION}" ;; - (*) - echo "Invalid build type: ${BUILD_TYPE}"; exit 1 ;; - esac - - # Do not output ##vso[] commands with `set -x` or they may be parsed again and include a trailing quote. - set +x - - set_var() { - local VAR_NAME=${1:?} - local VAR_VALUE=${2:?} - echo "##vso[task.setvariable variable=${VAR_NAME};isoutput=true;isreadonly=true]${VAR_VALUE}" - echo "${VAR_NAME}: ${VAR_VALUE}" - } - - set_var "ORT_POD_VERSION" "${VERSION}" - displayName: "Set common variables" - name: SetCommonVariables - template: templates/stages/mac-ios-packaging-build-stage.yml parameters: diff --git a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml index 627cf32610..954777c803 100644 --- a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml +++ b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml @@ -7,8 +7,6 @@ parameters: stages: - stage: IosPackaging_Build_${{ parameters.packageVariant }} - dependsOn: - - IosPackaging_SetCommonVariables jobs: - job: displayName: "Build iOS package for variant: ${{ parameters.packageVariant}}" @@ -42,6 +40,37 @@ stages: targetPath: $(Build.ArtifactStagingDirectory) artifactName: browserstack_test_artifacts_${{ lower(parameters.packageVariant) }} steps: + - bash: | + set -e + + BUILD_TYPE="${{ parameters.buildType }}" + BASE_VERSION="$(cat ./VERSION_NUMBER)" + SHORT_COMMIT_HASH="$(git rev-parse --short HEAD)" + DEV_VERSION="${BASE_VERSION}-dev+$(Build.BuildNumber).${SHORT_COMMIT_HASH}" + + case "${BUILD_TYPE}" in + ("release") + VERSION="${BASE_VERSION}" ;; + ("normal") + VERSION="${DEV_VERSION}" ;; + (*) + echo "Invalid build type: ${BUILD_TYPE}"; exit 1 ;; + esac + + # Do not output ##vso[] commands with `set -x` or they may be parsed again and include a trailing quote. + set +x + + set_var() { + local VAR_NAME=${1:?} + local VAR_VALUE=${2:?} + echo "##vso[task.setvariable variable=${VAR_NAME};isoutput=true;isreadonly=true]${VAR_VALUE}" + echo "${VAR_NAME}: ${VAR_VALUE}" + } + + set_var "ORT_POD_VERSION" "${VERSION}" + displayName: "Set common variables" + name: SetCommonVariables + - script: | if [[ -z "$(ortPodVersion)" ]]; then echo "ORT pod version is unspecified. Make sure that the IosPackaging_SetCommonVariables stage has run."