Skip to content

Commit bec9bd8

Browse files
authored
Use pinned pypi-shipped uv through CFS rather than uv native installer (#46296)
* cutover to use pypi uv * fix up order of operations. We ALWAYS want UsePythonVersion -> AuthDevFeed --> Install UV globally from pypi -> prepend path so uv is always available.
1 parent 4ea3dd1 commit bec9bd8

8 files changed

Lines changed: 43 additions & 39 deletions

File tree

eng/pipelines/aggregate-reports.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ stages:
2929
inputs:
3030
versionSpec: '$(PythonVersion)'
3131

32+
- template: /eng/pipelines/templates/steps/auth-dev-feed.yml
33+
parameters:
34+
EnableTwineAuth: false
35+
3236
- template: /eng/pipelines/templates/steps/use-venv.yml
3337

3438
- template: /eng/pipelines/templates/steps/analyze_dependency.yml

eng/pipelines/templates/jobs/ci.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,12 @@ jobs:
213213
condition: succeededOrFailed()
214214
inputs:
215215
versionSpec: $(PythonVersion)
216+
217+
- template: /eng/pipelines/templates/steps/auth-dev-feed.yml
218+
parameters:
219+
DevFeedName: ${{ parameters.DevFeedName }}
220+
EnableTwineAuth: false
221+
216222
- template: /eng/pipelines/templates/steps/use-venv.yml
217223

218224
- template: /eng/common/pipelines/templates/steps/check-spelling.yml
@@ -281,10 +287,14 @@ jobs:
281287
- task: UsePythonVersion@0
282288
inputs:
283289
versionSpec: '3.12'
284-
- template: /eng/pipelines/templates/steps/use-venv.yml
290+
285291
- template: ../steps/auth-dev-feed.yml
286292
parameters:
287293
DevFeedName: ${{ parameters.DevFeedName }}
294+
EnableTwineAuth: false
295+
296+
- template: /eng/pipelines/templates/steps/use-venv.yml
297+
288298
- template: /eng/common/pipelines/templates/steps/save-package-properties.yml
289299
parameters:
290300
ServiceDirectory: ${{parameters.ServiceDirectory}}
@@ -322,11 +332,13 @@ jobs:
322332
- task: UsePythonVersion@0
323333
inputs:
324334
versionSpec: '3.12'
325-
- template: /eng/pipelines/templates/steps/use-venv.yml
326335

327336
- template: ../steps/auth-dev-feed.yml
328337
parameters:
329338
DevFeedName: ${{ parameters.DevFeedName }}
339+
EnableTwineAuth: false
340+
341+
- template: /eng/pipelines/templates/steps/use-venv.yml
330342

331343
- pwsh: |
332344
$ErrorActionPreference = 'Stop'

eng/pipelines/templates/steps/auth-dev-feed.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,7 @@ steps:
4343
} else {
4444
Write-Host "##[warning]PIP_INDEX_URL not set - uv will fall back to public PyPI."
4545
}
46+
# Force any managed Python downloads to go directly to GitHub releases
47+
# rather than the default CDN (releases.astral.sh).
48+
Write-Host "##vso[task.setvariable variable=UV_PYTHON_INSTALL_MIRROR]https://github.com/astral-sh/python-build-standalone/releases/download"
4649
displayName: 'Configure UV Authentication'

eng/pipelines/templates/steps/build-extended-artifacts.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ steps:
2828
- template: auth-dev-feed.yml
2929
parameters:
3030
DevFeedName: ${{ parameters.DevFeedName }}
31+
EnableTwineAuth: false
3132

3233
- task: UsePythonVersion@0
3334
displayName: 'Use Python 3.13'

eng/pipelines/templates/steps/build-package-artifacts.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,19 @@ steps:
3232
Paths:
3333
- '**'
3434

35-
# Authenticate to Azure Artifacts feed immediately after checkout to prevent 401 errors
36-
# Public feeds have upstream sources enabled and require authentication for passthrough to pypi.org
37-
- template: auth-dev-feed.yml
38-
parameters:
39-
DevFeedName: ${{ parameters.DevFeedName }}
40-
4135
- task: UsePythonVersion@0
4236
displayName: 'Use Python $(PythonVersion)'
4337
condition: and(succeeded(), or(eq(variables['ENABLE_EXTENSION_BUILD'], 'true'), eq('${{ parameters.ArtifactSuffix }}', 'linux')))
4438
inputs:
4539
versionSpec: $(PythonVersion)
4640

41+
# Authenticate to Azure Artifacts feed immediately after checkout to prevent 401 errors
42+
# Public feeds have upstream sources enabled and require authentication for passthrough to pypi.org
43+
- template: auth-dev-feed.yml
44+
parameters:
45+
DevFeedName: ${{ parameters.DevFeedName }}
46+
EnableTwineAuth: false
47+
4748
- template: /eng/pipelines/templates/steps/use-venv.yml
4849

4950
- template: /eng/common/pipelines/templates/steps/set-test-pipeline-version.yml@self

eng/pipelines/templates/steps/build-test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ steps:
2626
parameters:
2727
versionSpec: '${{ parameters.PythonVersion }}'
2828

29-
- template: /eng/pipelines/templates/steps/use-venv.yml
30-
3129
# Authenticate to Azure Artifacts feed immediately after checkout to prevent 401 errors
3230
# Public feeds have upstream sources enabled and require authentication for passthrough to pypi.org
3331
- template: /eng/pipelines/templates/steps/auth-dev-feed.yml
3432
parameters:
3533
DevFeedName: ${{ parameters.DevFeedName }}
34+
EnableTwineAuth: false
35+
36+
- template: /eng/pipelines/templates/steps/use-venv.yml
3637

3738
- template: /eng/common/pipelines/templates/steps/set-test-pipeline-version.yml
3839
parameters:
Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,13 @@
1-
21
steps:
3-
- task: Bash@3
4-
displayName: 'Install uv (Linux/macOS)'
5-
inputs:
6-
targetType: inline
7-
script: |
8-
curl -LsSf https://astral.sh/uv/install.sh | sh
9-
condition: or(eq(variables['Agent.OS'], 'Linux'), eq(variables['Agent.OS'], 'Darwin'))
10-
11-
- task: Bash@3
12-
inputs:
13-
targetType: inline
14-
script: |
15-
echo "##vso[task.prependpath]$HOME/.local/bin"
16-
displayName: 'Prepend path for MacOS'
17-
condition: eq(variables['Agent.OS'], 'Darwin')
2+
- pwsh: |
3+
$ErrorActionPreference = 'Stop'
4+
$PSNativeCommandUseErrorActionPreference = $true
5+
$indexUrl = if ($env:PIP_INDEX_URL) { $env:PIP_INDEX_URL } else { 'https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/' }
6+
python -m pip install uv==0.11.6 --index-url $indexUrl
187
19-
- task: PowerShell@2
20-
displayName: 'Install uv (Windows)'
21-
inputs:
22-
targetType: inline
23-
script: |
24-
iex (irm https://astral.sh/uv/install.ps1)
25-
Write-Host "##vso[task.prependpath]$env:USERPROFILE\.local\bin"
26-
condition: eq(variables['Agent.OS'], 'Windows_NT')
8+
# prepend the path to the installed uv to the PATH so that it can be used in subsequent steps without needing to know the exact path or relying
9+
# the global python instance being prepended on the PATH
10+
$scriptsDir = python -c "import sysconfig; print(sysconfig.get_path('scripts'))"
11+
$env:PATH = "$scriptsDir$([System.IO.Path]::PathSeparator)$env:PATH"
12+
Write-Host "##vso[task.prependpath]$scriptsDir"
13+
displayName: 'Install uv'

eng/pipelines/templates/steps/run_apistub.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ parameters:
55

66
# Please use `$(TargetingString)` to refer to the python packages glob string. This variable is set from resolve-package-targeting.yml.
77
steps:
8-
- pwsh: |
9-
Write-Host "##vso[task.setvariable variable=PIP_INDEX_URL]https://pypi.python.org/simple"
10-
displayName: Reset PIP Index For APIStubGen
11-
condition: and(succeededOrFailed(), eq(variables['Skip.ApiStubGen'],'true'))
12-
138
- task: UsePythonVersion@0
149
displayName: 'Use Python 3.10'
1510
inputs:

0 commit comments

Comments
 (0)