Skip to content

Commit a5ca835

Browse files
Copilotscbedd
andauthored
Move pip authentication to run immediately after checkout in all pipeline jobs (#45223)
* Move pip authentication to run immediately after checkout in all pipeline jobs Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: scbedd <45376673+scbedd@users.noreply.github.com>
1 parent 77a3394 commit a5ca835

7 files changed

Lines changed: 42 additions & 32 deletions

File tree

eng/pipelines/templates/jobs/ci.tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ jobs:
9696
Paths:
9797
- '**'
9898

99+
# Authenticate to Azure Artifacts feed immediately after checkout to prevent 401 errors
100+
# Public feeds have upstream sources enabled and require authentication for passthrough to pypi.org
101+
- template: /eng/pipelines/templates/steps/auth-dev-feed.yml
102+
99103
- template: /eng/pipelines/templates/steps/download-package-artifacts.yml
100104

101105
- template: /eng/pipelines/templates/steps/resolve-package-targeting.yml

eng/pipelines/templates/jobs/regression.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ jobs:
7171

7272
# Please use `$(TargetingString)` to refer to the python packages glob string. This was previously `${{ parameters.BuildTargetingString }}`.
7373
steps:
74+
# Authenticate to Azure Artifacts feed immediately after checkout to prevent 401 errors
75+
# Public feeds have upstream sources enabled and require authentication for passthrough to pypi.org
76+
- template: ../steps/auth-dev-feed.yml
77+
parameters:
78+
DevFeedName: ${{ parameters.DevFeedName }}
79+
7480
- template: /eng/pipelines/templates/steps/resolve-package-targeting.yml
7581
parameters:
7682
BuildTargetingString: ${{ parameters.BuildTargetingString }}
@@ -97,11 +103,6 @@ jobs:
97103
parameters:
98104
ServiceDirectory: ${{ parameters.ServiceDirectory }}
99105

100-
- ${{if eq(variables['System.TeamProject'], 'internal') }}:
101-
- template: ../steps/auth-dev-feed.yml
102-
parameters:
103-
DevFeedName: ${{ parameters.DevFeedName }}
104-
105106
- task: PythonScript@0
106107
displayName: 'Test Latest Released Dependents'
107108
inputs:

eng/pipelines/templates/steps/analyze.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ parameters:
1010

1111
# Please use `$(TargetingString)` to refer to the python packages glob string. This variable is set from resolve-package-targeting.yml.
1212
steps:
13+
# Authenticate to Azure Artifacts feed immediately to prevent 401 errors
14+
# Public feeds have upstream sources enabled and require authentication for passthrough to pypi.org
15+
- template: ../steps/auth-dev-feed.yml
16+
parameters:
17+
DevFeedName: ${{ parameters.DevFeedName }}
18+
1319
- template: /eng/pipelines/templates/steps/analyze_dependency.yml
1420
parameters:
1521
ScanPath: $(Build.SourcesDirectory)/sdk/${{ parameters.ServiceDirectory }}
@@ -20,11 +26,6 @@ steps:
2026
ServiceDirectory: "template"
2127
TestPipeline: ${{ parameters.TestPipeline }}
2228

23-
- ${{if eq(variables['System.TeamProject'], 'internal') }}:
24-
- template: ../steps/auth-dev-feed.yml
25-
parameters:
26-
DevFeedName: ${{ parameters.DevFeedName }}
27-
2829
- task: PythonScript@0
2930
displayName: 'Set Checks Environment Skips'
3031
condition: succeededOrFailed()

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,17 @@ steps:
2525
artifactFeeds: $(DevFeedName)
2626
onlyAddExtraIndex: false
2727

28-
# disabled until completion of python part of azure/azure-sdk-tools#9101
29-
# - pwsh: |
30-
# if ($env:PIP_INDEX_URL) {
31-
# Write-Host "PIP Index URL detected: $env:PIP_INDEX_URL"
32-
# Write-Host "##vso[task.setvariable variable=UV_DEFAULT_INDEX]$($env:PIP_INDEX_URL)"
33-
# }
34-
# displayName: 'Mirror PIP Index URL to UV Index URL'
28+
# Disabled UV authentication step - for future enablement when UV fully supports Azure Artifacts
29+
# To enable: uncomment this step and ensure UV_INDEX_URL is properly configured
30+
# The PipAuthenticate task above creates a .pypirc file in the home directory that UV can use
31+
- pwsh: |
32+
# This step configures UV to use the same authentication as pip
33+
# UV will read credentials from ~/.pypirc created by PipAuthenticate task
34+
if ($env:PIP_INDEX_URL) {
35+
Write-Host "PIP Index URL detected: $env:PIP_INDEX_URL"
36+
# Uncomment the next line to enable UV authentication
37+
# Write-Host "##vso[task.setvariable variable=UV_INDEX_URL]$($env:PIP_INDEX_URL)"
38+
Write-Host "UV authentication is currently disabled. To enable, uncomment the variable assignment above."
39+
}
40+
displayName: 'Configure UV Authentication (Disabled)'
41+
condition: false # Explicitly disabled - change to 'true' or remove to enable

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ parameters:
2323

2424
# Please use `$(TargetingString)` to refer to the python packages glob string. This variable is set from resolve-package-targeting.yml.
2525
steps:
26+
# Authenticate to Azure Artifacts feed immediately after checkout to prevent 401 errors
27+
# Public feeds have upstream sources enabled and require authentication for passthrough to pypi.org
28+
- template: auth-dev-feed.yml
29+
parameters:
30+
DevFeedName: ${{ parameters.DevFeedName }}
31+
2632
- task: UsePythonVersion@0
2733
displayName: 'Use Python 3.13'
2834
inputs:
@@ -37,11 +43,6 @@ steps:
3743
}
3844
displayName: Set Component Governance Path
3945
40-
- ${{if eq(variables['System.TeamProject'], 'internal') }}:
41-
- template: auth-dev-feed.yml
42-
parameters:
43-
DevFeedName: ${{ parameters.DevFeedName }}
44-
4546
- template: /eng/common/pipelines/templates/steps/set-test-pipeline-version.yml
4647
parameters:
4748
PackageName: "azure-template"

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ 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+
3541
- task: UsePythonVersion@0
3642
displayName: 'Use Python $(PythonVersion)'
3743
condition: and(succeeded(), or(eq(variables['ENABLE_EXTENSION_BUILD'], 'true'), eq('${{ parameters.ArtifactSuffix }}', 'linux')))
@@ -48,11 +54,6 @@ steps:
4854

4955
- template: /eng/common/pipelines/templates/steps/set-default-branch.yml@self
5056

51-
- ${{if eq(variables['System.TeamProject'], 'internal') }}:
52-
- template: auth-dev-feed.yml
53-
parameters:
54-
DevFeedName: ${{ parameters.DevFeedName }}
55-
5657
- script: |
5758
echo "##vso[build.addbuildtag]Scheduled"
5859
displayName: 'Tag scheduled builds'

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ steps:
3636

3737
- template: set-dev-build.yml
3838

39-
- ${{if eq(variables['System.TeamProject'], 'internal') }}:
40-
- template: ../steps/auth-dev-feed.yml
41-
parameters:
42-
DevFeedName: ${{ parameters.DevFeedName }}
43-
4439
- pwsh: |
4540
Write-Host (Get-Command python).Source
4641
$ErrorActionPreference = 'Stop'

0 commit comments

Comments
 (0)