onnxruntime/tools/ci_build/github/azure-pipelines/templates/get-docker-image-steps.yml
Changming Sun 29ed8811e5
Move C/C++ deps' URLs to deps.txt (#13769)
### Description
1. Move C/C++ deps' URLs to deps.txt, and download the dependencies from
Azure Devops Artifacts instead of github.
2. Add "EXCLUDE_FROM_ALL" keyword to the cmake external projects, so
that we only build the parts we need and avoid installing the 3rd-party
dependencies when people run `make install` in ORT's build directory.
However, at this moment cmake itself doesn't have the feature. So I
copied their code to cmake/external/helper_functions.cmake and modified
it.

This PR is split from #13523, to make that one smaller. 

### Motivation and Context
1. Secure the supply chain
2. Make it be possible to automatically detect if ORT has an old
dependency that hasn't been updated from a long time.
2022-11-29 18:06:35 -08:00

68 lines
No EOL
2.4 KiB
YAML

# calls tools/ci_build/get_docker_image.py
parameters:
- name: Dockerfile
type: string
- name: Context
type: string
- name: DockerBuildArgs
type: string
default: ""
- name: Repository
type: string
- name: UseImageCacheContainerRegistry
type: boolean
default: true
- name: ScriptName
type: string
default: "tools/ci_build/get_docker_image.py"
- name: UpdateDepsTxt
type: boolean
default: true
steps:
- ${{ if eq(parameters.UpdateDepsTxt, true)}}:
- template: download-deps.yml
- ${{ if contains(parameters.Dockerfile, 'manylinux') }}:
- checkout: manylinux
- script: |
set -e -x
mv manylinux onnxruntime
mv onnxruntime ..
cd ..
rmdir $(Build.SourcesDirectory)
mv onnxruntime $(Build.SourcesDirectory)
displayName: "Move Manylinux source code to ORT folder"
- ${{ if eq(parameters.UseImageCacheContainerRegistry, true) }}:
- template: with-container-registry-steps.yml
parameters:
Steps:
- script: |
${{ parameters.ScriptName }} \
--dockerfile "${{ parameters.Dockerfile }}" \
--context "${{ parameters.Context }}" \
--docker-build-args "${{ parameters.DockerBuildArgs }}" \
--container-registry onnxruntimebuildcache \
--repository "${{ parameters.Repository }}"
displayName: "Get ${{ parameters.Repository }} image for ${{ parameters.Dockerfile }}"
ContainerRegistry: onnxruntimebuildcache
- ${{ if eq(parameters.UseImageCacheContainerRegistry, false) }}:
- script: |
${{ parameters.ScriptName }} \
--dockerfile "${{ parameters.Dockerfile }}" \
--context "${{ parameters.Context }}" \
--docker-build-args "${{ parameters.DockerBuildArgs }}" \
--repository "${{ parameters.Repository }}"
displayName: "Get ${{ parameters.Repository }} image for ${{ parameters.Dockerfile }}"
- ${{ if and(eq(parameters.UpdateDepsTxt, true), or(eq(variables['System.CollectionId'], 'f3ad12f2-e480-4533-baf2-635c95467d29'),eq(variables['System.CollectionId'], 'bc038106-a83b-4dab-9dd3-5a41bc58f34c'))) }}:
- task: PythonScript@0
displayName: 'Update deps.txt'
inputs:
scriptPath: $(Build.SourcesDirectory)/tools/ci_build/replace_urls_in_deps.py
arguments: --new_dir /build/deps
workingDirectory: $(Build.BinariesDirectory)
pythonInterpreter: /usr/bin/python3