Skip to content

Commit

Permalink
Azure pipeline task CondaEnvironment@1 has been deprecated. (#2309)
Browse files Browse the repository at this point in the history
* Replace CondaEnvironment@1 azure task with UsePythonVersion@0.
* Remove unnecessary steps.

---------

Signed-off-by: Jay Zhang <[email protected]>
  • Loading branch information
fatcat-z authored Mar 6, 2024
1 parent 9538da8 commit 358b519
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 41 deletions.
8 changes: 3 additions & 5 deletions ci_build/azure_pipelines/templates/combine_test_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ stages:
artifactName: '${{ parameters.artifact_name }}'
downloadPath: $(System.DefaultWorkingDirectory)

- task: CondaEnvironment@1
- task: UsePythonVersion@0
inputs:
createCustomEnvironment: 'true'
environmentName: 'tf2onnx'
packageSpecs: 'python=3.7'
updateConda: 'false'
versionSpec: '3.7'
architecture: 'x64'

- bash: |
pip install -U coverage
Expand Down
18 changes: 3 additions & 15 deletions ci_build/azure_pipelines/templates/job_generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,10 @@ jobs:
- bash: env
displayName: 'Display Environment Variables'

# TODO: ordinary python is preferred but built-in python3.6 does not have libpython3.6m.so, onnxruntime will fail with
# Error: 'libpython3.6m.so.1.0: cannot open shared object file: No such file or directory'
# so have to use conda here, may switch back to UsePythonVersion when the issue is fixed.
# - task: UsePythonVersion@0
# inputs:
# versionSpec: '$(CI_PYTHON_VERSION)'
# architecture: 'x64'

# TODO: Conda Environment task is deprecating, move to raw python after issue above is fixed.
# https://github.com/Microsoft/azure-pipelines-tasks/pull/9573
- task: CondaEnvironment@1
- task: UsePythonVersion@0
inputs:
createCustomEnvironment: 'true'
environmentName: 'tf2onnx'
packageSpecs: 'python=$(CI_PYTHON_VERSION)'
updateConda: 'false'
versionSpec: '$(CI_PYTHON_VERSION)'
architecture: 'x64'

- ${{ if eq(parameters.run_setup, 'True') }}:
- template: 'setup.yml'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ steps:
- script: sudo install -d -m 0777 /home/vsts/.conda/envs
displayName: Fix Conda permissions

- task: CondaEnvironment@1
- task: UsePythonVersion@0
inputs:
createCustomEnvironment: true
environmentName: 'py$(python.version)'
packageSpecs: 'python=$(python.version)'
versionSpec: '$(python.version)'
architecture: 'x64'

- script: |
python -m pip install --upgrade pip
Expand Down Expand Up @@ -80,11 +79,7 @@ steps:
- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
displayName: Add conda to PATH

- script: conda create --yes --quiet --name py$(python.version) -c conda-forge python=$(python.version) numpy protobuf~=3.20
displayName: Create Anaconda environment

- script: |
call activate py$(python.version)
python -m pip install --upgrade pip numpy
echo Test numpy installation... && python -c "import numpy"
pip install onnxconverter-common
Expand Down Expand Up @@ -119,7 +114,6 @@ steps:
displayName: 'Install dependencies'
- script: |
call activate py$(python.version)
pip install -e .
echo Test onnxruntime installation... && python -c "import onnxruntime"
pytest tests/keras2onnx_unit_tests --doctest-modules --junitxml=junit/test-results.xml
Expand Down
15 changes: 3 additions & 12 deletions ci_build/azure_pipelines/templates/keras2onnx_unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ steps:
- script: sudo install -d -m 0777 /home/vsts/.conda/envs
displayName: Fix Conda permissions

- task: CondaEnvironment@1
- task: UsePythonVersion@0
inputs:
createCustomEnvironment: true
environmentName: 'py$(python.version)'
packageSpecs: 'python=$(python.version)'
versionSpec: '$(python.version)'
architecture: 'x64'

- script: |
python -m pip install --upgrade pip
Expand Down Expand Up @@ -63,14 +62,7 @@ steps:
versionSpec: '$(python.version)'
architecture: 'x64'

- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
displayName: Add conda to PATH

- script: conda create --yes --quiet --name py$(python.version) -c conda-forge python=$(python.version) numpy protobuf~=3.20
displayName: Create Anaconda environment

- script: |
call activate py$(python.version)
python -m pip install --upgrade pip numpy
echo Test numpy installation... && python -c "import numpy"
pip install onnxconverter-common
Expand All @@ -91,7 +83,6 @@ steps:
displayName: 'Install dependencies'
- script: |
call activate py$(python.version)
pip install -e .
echo Test onnxruntime installation... && python -c "import onnxruntime"
python -c "import onnxconverter_common"
Expand Down

0 comments on commit 358b519

Please sign in to comment.