Skip to content

Commit 0d2d647

Browse files
Always set PIP_INDEX_URL
1 parent 3bc5eed commit 0d2d647

2 files changed

Lines changed: 35 additions & 21 deletions

File tree

eng/pipelines/stages/dotnet-buildtools-prereqs.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,19 @@ stages:
2323
name: NetCore1ESPool-Internal-XL
2424
image: build.ubuntu.2204.amd64
2525
os: linux
26-
${{ if eq(variables['System.TeamProject'], 'internal') }}:
27-
customCopyBaseImagesInitSteps:
26+
customBuildInitSteps:
27+
- template: /eng/pipelines/steps/pip-authenticate.yml@self
28+
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
2829
- template: /eng/pipelines/steps/set-base-image-override-options.yml@self
2930
parameters:
30-
variableName: customCopyBaseImagesArgs
31+
variableName: imageBuilderBuildArgs
3132
dockerfileOs: (centos|debian)
3233
baseOverrideRegistry: $(overrideRegistry) # Comes from DotNet-Docker-Common variable group
33-
customBuildInitSteps:
34-
- template: /eng/pipelines/steps/pip-authenticate.yml@self
34+
${{ if eq(variables['System.TeamProject'], 'internal') }}:
35+
customCopyBaseImagesInitSteps:
3536
- template: /eng/pipelines/steps/set-base-image-override-options.yml@self
3637
parameters:
37-
variableName: imageBuilderBuildArgs
38+
variableName: customCopyBaseImagesArgs
3839
dockerfileOs: (centos|debian)
3940
baseOverrideRegistry: $(overrideRegistry) # Comes from DotNet-Docker-Common variable group
4041
# Force all images to be rebuilt when triggered by the schedule
Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
11
steps:
2-
- task: PipAuthenticate@1
3-
displayName: 'Pip Authenticate'
4-
inputs:
5-
# Authenticates the dotnet-public-pypi feed (a full pypi mirror) and sets
6-
# PIP_INDEX_URL to the authenticated URL. Dockerfiles that install Helix
7-
# wheels override the index per-command to point at helix-client-prod and
8-
# use this value as --extra-index-url so transitive deps fall back to the
9-
# full mirror when the curated Helix feed lacks a matching wheel.
10-
artifactFeeds: public/dotnet-public-pypi,public/helix-client-prod
11-
onlyAddExtraIndex: false
12-
- powershell: |
13-
$options = "$(imageBuilderBuildArgs)"
14-
$options += " --build-arg PIP_INDEX_URL=$env:PIP_INDEX_URL --build-arg NPM_TOKEN=$(System.AccessToken)"
15-
echo "##vso[task.setvariable variable=imageBuilderBuildArgs]$options"
16-
displayName: Set PIP and NPM Build Args
2+
# Provide PIP_INDEX_URL (and, internally, NPM_TOKEN) as image build args.
3+
# Dockerfiles that install Helix wheels override the index per-command to point
4+
# at helix-client-prod and use PIP_INDEX_URL as --extra-index-url so transitive
5+
# deps fall back to the full dotnet-public-pypi mirror when the curated Helix
6+
# feed lacks a matching wheel.
7+
#
8+
# Both feeds live in the dnceng org's public project. Internally we authenticate
9+
# them (so the pypi mirror can pull packages through from upstream and to avoid
10+
# anonymous throttling). In the public project those feeds are in a different
11+
# org and a fork-PR token can't authenticate them, but they are anonymously
12+
# readable, so we point PIP_INDEX_URL straight at the mirror with no token.
13+
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
14+
- task: PipAuthenticate@1
15+
displayName: 'Pip Authenticate'
16+
inputs:
17+
artifactFeeds: public/dotnet-public-pypi,public/helix-client-prod
18+
onlyAddExtraIndex: false
19+
- powershell: |
20+
$options = "$(imageBuilderBuildArgs)"
21+
$options += " --build-arg PIP_INDEX_URL=$env:PIP_INDEX_URL --build-arg NPM_TOKEN=$(System.AccessToken)"
22+
echo "##vso[task.setvariable variable=imageBuilderBuildArgs]$options"
23+
displayName: Set PIP and NPM Build Args
24+
- ${{ else }}:
25+
- powershell: |
26+
$options = "$(imageBuilderBuildArgs)"
27+
$options += " --build-arg PIP_INDEX_URL=https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-pypi/pypi/simple/"
28+
echo "##vso[task.setvariable variable=imageBuilderBuildArgs]$options"
29+
displayName: Set Public PIP Build Arg

0 commit comments

Comments
 (0)