Skip to content

Commit 3ae7c3c

Browse files
authored
Enable 1ES on Python CUDA Package Pipelines (#22560)
### Description These 3 following CUDA packaging pipeline shoud be enabled with 1ES after this pull request. • [Python-CUDA-Packaging-Pipeline](https://dev.azure.com/aiinfra/Lotus/_build?definitionId=1299&view=runs) • [Python CUDA Alt Packaging Pipeline](https://dev.azure.com/aiinfra/Lotus/_build?definitionId=1626) • [Python DML Packaging Pipeline](https://dev.azure.com/aiinfra/Lotus/_build?definitionId=1625) This should also fix the issue where [Python packaging pipeline](https://aiinfra.visualstudio.com/Lotus/_build?definitionId=841&_a=summary) failed due to cannot find `publish_symbols` ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. -->
1 parent cd60af0 commit 3ae7c3c

File tree

6 files changed

+63
-90
lines changed

6 files changed

+63
-90
lines changed

tools/ci_build/github/azure-pipelines/py-cuda-alt-packaging-pipeline.yml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
trigger: none
2-
2+
resources:
3+
repositories:
4+
- repository: 1esPipelines
5+
type: git
6+
name: 1ESPipelineTemplates/1ESPipelineTemplates
7+
ref: refs/tags/release
38
parameters:
49
- name: enable_linux_cuda
510
type: boolean
@@ -17,11 +22,21 @@ parameters:
1722
- Release
1823
- RelWithDebInfo
1924
- MinSizeRel
25+
extends:
26+
# The pipeline extends the 1ES PT which will inject different SDL and compliance tasks.
27+
# For non-production pipelines, use "Unofficial" as defined below.
28+
# For productions pipelines, use "Official".
29+
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
30+
parameters:
31+
# Update the pool with your team's 1ES hosted pool.
32+
pool:
33+
name: 'onnxruntime-Win-CPU-2022' # Name of your hosted pool
34+
os: windows # OS of the image. This value cannot be a variable. Allowed values: windows, linux, macOS
2035

21-
stages:
22-
- template: stages/py-gpu-packaging-stage.yml
23-
parameters:
24-
enable_linux_cuda: ${{ parameters.enable_linux_cuda }}
25-
enable_windows_cuda: ${{ parameters.enable_windows_cuda }}
26-
cmake_build_type: ${{ parameters.cmake_build_type }}
27-
cuda_version: '11.8'
36+
stages:
37+
- template: stages/py-gpu-packaging-stage.yml
38+
parameters:
39+
enable_linux_cuda: ${{ parameters.enable_linux_cuda }}
40+
enable_windows_cuda: ${{ parameters.enable_windows_cuda }}
41+
cmake_build_type: ${{ parameters.cmake_build_type }}
42+
cuda_version: '11.8'
Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
trigger: none
2-
2+
resources:
3+
repositories:
4+
- repository: 1esPipelines
5+
type: git
6+
name: 1ESPipelineTemplates/1ESPipelineTemplates
7+
ref: refs/tags/release
38
parameters:
49
- name: cmake_build_type
510
type: string
@@ -9,10 +14,19 @@ parameters:
914
- Release
1015
- RelWithDebInfo
1116
- MinSizeRel
17+
extends:
18+
# The pipeline extends the 1ES PT which will inject different SDL and compliance tasks.
19+
# For non-production pipelines, use "Unofficial" as defined below.
20+
# For productions pipelines, use "Official".
21+
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
22+
parameters:
23+
# Update the pool with your team's 1ES hosted pool.
24+
pool:
25+
name: 'onnxruntime-Win-CPU-2022' # Name of your hosted pool
26+
os: windows # OS of the image. This value cannot be a variable. Allowed values: windows, linux, macOS
1227

13-
stages:
14-
- template: stages/py-gpu-packaging-stage.yml
15-
parameters:
16-
enable_windows_dml: true
17-
cmake_build_type: ${{ parameters.cmake_build_type }}
18-
publish_symbols: true
28+
stages:
29+
- template: stages/py-gpu-packaging-stage.yml
30+
parameters:
31+
enable_windows_dml: true
32+
cmake_build_type: ${{ parameters.cmake_build_type }}

tools/ci_build/github/azure-pipelines/py-packaging-pipeline.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,3 @@ stages:
7777
build_py_parameters: ${{ parameters.build_py_parameters }}
7878
cmake_build_type: ${{ parameters.cmake_build_type }}
7979
qnn_sdk_version: ${{ parameters.qnn_sdk_version }}
80-
publish_symbols: true
81-

tools/ci_build/github/azure-pipelines/stages/py-gpu-packaging-stage.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ parameters:
4848
- '3.12'
4949
- '3.13'
5050

51-
- name: publish_symbols
52-
type: boolean
53-
default: false
54-
5551
stages:
5652
- ${{ if eq(parameters.enable_windows_cuda, true) }}:
5753
- ${{ each python_version in parameters.PythonVersions }}:
@@ -89,5 +85,4 @@ stages:
8985
EP_BUILD_FLAGS: --use_dml --cmake_extra_defines CMAKE_SYSTEM_VERSION=10.0.18362.0 --enable_wcos
9086
ENV_SETUP_SCRIPT: setup_env.bat
9187
EP_NAME: directml
92-
publish_symbols: ${{ parameters.publish_symbols }}
9388
cmake_build_type: ${{ parameters.cmake_build_type }}

tools/ci_build/github/azure-pipelines/stages/py-linux-gpu-stage.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ stages:
9999
mv $(Build.BinariesDirectory)/dist ./dist
100100
pushd dist
101101
find . -name \*.whl -exec unzip -qq -o {} \;
102+
rm -r onnxruntime
102103
popd
103104
pushd ${{ parameters.cmake_build_type }}
104105
find . -name \*.whl -exec unzip -qq -o {} \;

tools/ci_build/github/azure-pipelines/stages/py-win-gpu-stage.yml

Lines changed: 18 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ parameters:
3838
- RelWithDebInfo
3939
- MinSizeRel
4040

41-
- name: publish_symbols
42-
type: boolean
43-
default: false
44-
4541
stages:
4642
- stage: Win_py_${{ parameters.EP_NAME }}_Wheels_${{ replace(parameters.PYTHON_VERSION,'.','_') }}_Build
4743
dependsOn: []
@@ -52,6 +48,22 @@ stages:
5248
clean: all
5349
pool:
5450
name: onnxruntime-Win-CPU-2022
51+
os: windows
52+
templateContext:
53+
codeSignValidation:
54+
enabled: true
55+
break: true
56+
psscriptanalyzer:
57+
enabled: true
58+
sdl:
59+
binskim:
60+
enabled: true
61+
scanOutputDirectoryOnly: true
62+
targetPathPattern: '+:file|*.dll;-:file|DirectML.dll'
63+
outputs:
64+
- output: pipelineArtifact
65+
targetPath: $(Build.ArtifactStagingDirectory)
66+
artifactName: win_${{ parameters.EP_NAME }}_wheel_${{ parameters.PYTHON_VERSION }}
5567
variables:
5668
GRADLE_OPTS: '-Dorg.gradle.daemon=false'
5769
VSGenerator: 'Visual Studio 17 2022'
@@ -73,12 +85,6 @@ stages:
7385
addToPath: true
7486
architecture: 'x64'
7587

76-
- task: onebranch.pipeline.tsaoptions@1
77-
displayName: 'OneBranch TSAOptions'
78-
inputs:
79-
tsaConfigFilePath: '$(Build.SourcesDirectory)\.config\tsaoptions.json'
80-
appendSourceBranchName: false
81-
8288
- template: ../templates/download-deps.yml
8389

8490
- ${{ if ne(parameters.ENV_SETUP_SCRIPT, '') }}:
@@ -106,13 +112,6 @@ stages:
106112
arguments: --new_dir $(Build.BinariesDirectory)/deps
107113
workingDirectory: $(Build.BinariesDirectory)
108114

109-
- task: PowerShell@2
110-
displayName: 'Install ONNX'
111-
inputs:
112-
filePath: '$(Build.SourcesDirectory)/tools/ci_build/github/windows/install_third_party_deps.ps1'
113-
workingDirectory: '$(Build.BinariesDirectory)'
114-
arguments: -cpu_arch x64 -install_prefix $(Build.BinariesDirectory)\${{ parameters.cmake_build_type }}\installed -build_config ${{ parameters.cmake_build_type }}
115-
116115
- template: ../templates/set-nightly-build-option-variable-step.yml
117116

118117
- task: PythonScript@0
@@ -126,19 +125,7 @@ stages:
126125
--cmake_generator "$(VSGenerator)"
127126
--enable_pybind
128127
--enable_onnx_tests
129-
--parallel --use_binskim_compliant_compile_flags --update
130-
$(TelemetryOption) ${{ parameters.BUILD_PY_PARAMETERS }} ${{ parameters.EP_BUILD_FLAGS }}
131-
workingDirectory: '$(Build.BinariesDirectory)'
132-
133-
# building with build.py so the parallelization parameters are added to the msbuild command
134-
- task: PythonScript@0
135-
displayName: 'Build'
136-
inputs:
137-
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
138-
arguments: >
139-
--config ${{ parameters.cmake_build_type }}
140-
--build_dir $(Build.BinariesDirectory)
141-
--parallel --build
128+
--parallel --use_binskim_compliant_compile_flags --update --build
142129
$(TelemetryOption) ${{ parameters.BUILD_PY_PARAMETERS }} ${{ parameters.EP_BUILD_FLAGS }}
143130
workingDirectory: '$(Build.BinariesDirectory)'
144131

@@ -164,48 +151,11 @@ stages:
164151
Contents: '*.whl'
165152
TargetFolder: '$(Build.ArtifactStagingDirectory)'
166153

167-
- task: PublishBuildArtifacts@1
168-
displayName: 'Publish Artifact: ONNXRuntime python wheel'
169-
inputs:
170-
ArtifactName: onnxruntime_${{ parameters.EP_NAME }}
171-
172-
- ${{ if eq(parameters.publish_symbols, true) }}:
173-
- task: PublishSymbols@2
174-
displayName: 'Publish symbols'
175-
condition: and (succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/rel-')))
176-
inputs:
177-
SymbolsFolder: '$(Build.BinariesDirectory)\${{ parameters.cmake_build_type }}\${{ parameters.cmake_build_type }}'
178-
SearchPattern: |
179-
onnxruntime_pybind11_state.pdb
180-
onnxruntime_providers_shared.pdb
181-
IndexSources: true
182-
SymbolServerType: TeamServices
183-
SymbolExpirationInDays: 3650
184-
SymbolsArtifactName: 'win_${{ parameters.EP_NAME }}_${{ parameters.PYTHON_VERSION }}_$(Build.BuildNumber)'
185-
186154
- script: |
187155
7z x *.whl
188156
workingDirectory: '$(Build.ArtifactStagingDirectory)'
189157
displayName: 'unzip the package'
190158
191-
- task: CredScan@3
192-
displayName: 'Run CredScan'
193-
inputs:
194-
debugMode: false
195-
continueOnError: true
196-
197-
- task: BinSkim@4
198-
displayName: 'Run BinSkim'
199-
inputs:
200-
AnalyzeTargetGlob: '+:file|$(Build.ArtifactStagingDirectory)\**\*.dll;-:file|$(Build.ArtifactStagingDirectory)\**\DirectML.dll'
201-
202-
- task: TSAUpload@2
203-
displayName: 'TSA upload'
204-
condition: and (succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
205-
inputs:
206-
GdnPublishTsaOnboard: false
207-
GdnPublishTsaConfigFile: '$(Build.sourcesDirectory)\.gdn\.gdntsa'
208-
209159
- template: ../templates/component-governance-component-detection-steps.yml
210160
parameters:
211161
condition: 'succeeded'
@@ -235,7 +185,7 @@ stages:
235185

236186
- template: ../templates/flex-downloadPipelineArtifact.yml
237187
parameters:
238-
ArtifactName: onnxruntime_${{ parameters.EP_NAME }}
188+
ArtifactName: win_${{ parameters.EP_NAME }}_wheel_${{ parameters.PYTHON_VERSION }}
239189
StepName: 'Download Pipeline Artifact - Windows GPU Build'
240190
TargetPath: '$(Build.ArtifactStagingDirectory)'
241191

0 commit comments

Comments
 (0)