From ad17ea8e1625b6d882ab19332ffc94f64792f0bf Mon Sep 17 00:00:00 2001 From: Jian Chen Date: Thu, 6 Feb 2025 15:25:04 -0800 Subject: [PATCH] Make ios pipeline --- .../mac-ios-packaging-pipeline.yml | 108 ++++++++++-------- 1 file changed, 60 insertions(+), 48 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 c3176ec54f..7e176360b3 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 @@ -27,6 +27,12 @@ pr: - 'js/web' - 'onnxruntime/core/providers/js' #### end trigger #### +resources: + repositories: + - repository: 1esPipelines + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release parameters: - name: buildType @@ -41,59 +47,65 @@ parameters: default: normal name: "$(Date:yyyyMMdd)$(Rev:rrr)" # build number format - -stages: -- stage: IosPackaging_SetCommonVariables - dependsOn: [] - - variables: - skipComponentGovernanceDetection: true - - jobs: - - job: j - displayName: "Set common variables" - +extends: + # The pipeline extends the 1ES PT which will inject different SDL and compliance tasks. + # For non-production pipelines, use "Unofficial" as defined below. + # For productions pipelines, use "Official". + template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines + parameters: + # Update the pool with your team's 1ES hosted pool. pool: vmImage: "macOS-13" + os: macOS # OS of the image. This value cannot be a variable. Allowed values: windows, linux, macOS + stages: + - stage: IosPackaging_SetCommonVariables + dependsOn: [] - timeoutInMinutes: 5 + variables: + skipComponentGovernanceDetection: true - steps: - - bash: | - set -e + jobs: + - job: j + displayName: "Set common variables" - 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}" + timeoutInMinutes: 5 - case "${BUILD_TYPE}" in - ("release") - VERSION="${BASE_VERSION}" ;; - ("normal") - VERSION="${DEV_VERSION}" ;; - (*) - echo "Invalid build type: ${BUILD_TYPE}"; exit 1 ;; - esac + 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 - # Do not output ##vso[] commands with `set -x` or they may be parsed again and include a trailing quote. - set +x + - template: templates/stages/mac-ios-packaging-build-stage.yml + parameters: + packageVariant: Full - 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: - packageVariant: Full - -- template: templates/stages/mac-ios-packaging-build-stage.yml - parameters: - packageVariant: Training + - template: templates/stages/mac-ios-packaging-build-stage.yml + parameters: + packageVariant: Training