Skip to content

Commit 4096cd3

Browse files
Authenticate to python DevOps feed (#48116)
Co-authored-by: Chidozie Ononiwu <chononiw@microsoft.com>
1 parent e9e22cb commit 4096cd3

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
parameters:
2+
DevFeedName: 'public/azure-sdk-for-python'
3+
EnableTwineAuth: true
4+
EnablePipAuth: true
5+
EnableUvAuth: true
6+
7+
steps:
8+
- pwsh: |
9+
# For safety default to publishing to the private feed.
10+
# Publish to https://dev.azure.com/azure-sdk/internal/_packaging?_a=feed&feed=azure-sdk-for-python-pr
11+
$devopsFeedName = 'internal/azure-sdk-for-python-pr'
12+
if ('$(Build.Repository.Name)' -eq 'Azure/azure-sdk-for-python') {
13+
# Publish to https://dev.azure.com/azure-sdk/public/_packaging?_a=feed&feed=azure-sdk-for-python
14+
$devopsFeedName = '${{ parameters.DevFeedName }}'
15+
}
16+
echo "##vso[task.setvariable variable=DevFeedName]$devopsFeedName"
17+
echo "Using DevopsFeed = $devopsFeedName"
18+
displayName: Setup DevOpsFeedName
19+
20+
- ${{ if eq(parameters.EnableTwineAuth, true) }}:
21+
- task: TwineAuthenticate@0
22+
displayName: 'Twine Authenticate to feed'
23+
inputs:
24+
artifactFeeds: $(DevFeedName)
25+
26+
- ${{ if eq(parameters.EnablePipAuth, true) }}:
27+
- task: PipAuthenticate@1
28+
displayName: 'Pip Authenticate to feed'
29+
inputs:
30+
artifactFeeds: $(DevFeedName)
31+
onlyAddExtraIndex: false
32+
33+
- ${{ if eq(parameters.EnableUvAuth, true) }}:
34+
- pwsh: |
35+
if ($env:PIP_INDEX_URL) {
36+
Write-Host "Found pip index URL: $($env:PIP_INDEX_URL)"
37+
# UV_DEFAULT_INDEX is the canonical replacement for the deprecated UV_INDEX_URL (uv 0.4.23+).
38+
# PIP_INDEX_URL is set by PipAuthenticate@1 and contains embedded credentials, which uv
39+
# will use for Basic auth against the ADO feed (and its PyPI upstream) per astral-sh/uv#12651.
40+
Write-Host "##vso[task.setvariable variable=UV_DEFAULT_INDEX]$($env:PIP_INDEX_URL)"
41+
# Disable keyring so uv uses the URL-embedded credentials directly.
42+
Write-Host "##vso[task.setvariable variable=UV_KEYRING_PROVIDER]disabled"
43+
} else {
44+
Write-Host "##[warning]PIP_INDEX_URL not set - uv will fall back to public PyPI."
45+
}
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"
49+
displayName: 'Configure UV Authentication'

0 commit comments

Comments
 (0)