@@ -143,32 +143,29 @@ jobs:
143143 parameters :
144144 service_name : " ${{ parameters.service_name }}"
145145
146- # - bash: |
147- # echo "Setting python tool cache path"
148- # echo "##vso[task.setvariable variable=LD_LIBRARY_PATH;]:/agent/_work/_tool/Python/${{ parameters.python_version }}/x64/lib/"
149- # displayName: 'Set python tool cache path'
150-
151146 - bash : |
152- PATCH=$(curl -s https://api.github.com/repos/actions/python-versions/releases \
153- | jq -r '[.[] | .tag_name | select(startswith("'"${{ parameters.python_version }}"'"))] | .[]' \
154- | sort -V | tail -n 1 | cut -d- -f1)
147+ pyversion=${{ parameters.python_version }}
148+ PATCH=$(curl -fsSL https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json \
149+ | jq -r --arg pyversion "$pyversion" '[ .[] | select(.stable == true) | .version
150+ | select(test("^" + ($pyversion|gsub("\\.";"\\.")) + "\\.\\d+$")) | split(".") | map(tonumber)] | max | join(".")')
151+
152+ echo "##vso[task.setvariable variable=PY_VER]$PATCH"
155153 echo "Resolved latest python version: $PATCH"
156154 echo "##vso[task.setvariable variable=LD_LIBRARY_PATH;]/agent/_work/_tool/Python/${PATCH}/x64/lib/"
157- displayName: 'Query and set python tool cache path'
155+ displayName: 'Query and set python tool cache path'
156+
158157
159158 - task : UsePythonVersion@0
160159 name : UsePy
161- displayName : " Use Python ${{ parameters.python_version }}"
160+ displayName : ' Use Python ${{ parameters.python_version }}'
162161 inputs :
163- versionSpec : ${{ parameters.python_version }}
164-
162+ versionSpec : ' $(PY_VER)'
165163
166- - bash : |
167- echo "Checking the python version in use to set LD_LIBRARY_PATH"
168- echo "Python location: $(UsePy.pythonLocation)"
169- echo "##vso[task.setvariable variable=LD_LIBRARY_PATH]$(UsePy.pythonLocation)/lib"
170- displayName: 'Set LD_LIBRARY_PATH'
171-
164+ # - bash: |
165+ # echo "Checking the python version in use to set LD_LIBRARY_PATH"
166+ # echo "Python location: $(UsePy.pythonLocation)"
167+ # echo "##vso[task.setvariable variable=LD_LIBRARY_PATH]$(UsePy.pythonLocation)/lib"
168+ # displayName: 'Set LD_LIBRARY_PATH'
172169
173170 - ${{ each cache_step in parameters.cache_steps }} :
174171 - ${{ cache_step }}
0 commit comments