{C} Use Azure Artifacts feeds in release branch#29866
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
Packaging |
| --target build-env \ | ||
| --build-arg cli_version=${CLI_VERSION} \ | ||
| --build-arg image=${IMAGE} \ | ||
| --secret id=PIP_INDEX_URL \ |
There was a problem hiding this comment.
--build-arg also works, but I prefer --secret as the index url contains credential and secret does not record its value in image.
There was a problem hiding this comment.
It is interesting that env can be omitted:
https://docs.docker.com/build/building/secrets/#sources
When you use secrets from environment variables, you can omit the
envparameter to bind the secret to a file with the same name as the variable.
azure-pipelines.yml
Outdated
| - task: PipAuthenticate@1 | ||
| displayName: 'Pip Authenticate' | ||
| inputs: | ||
| artifactFeeds: 'public/azure-cli-feed' |
There was a problem hiding this comment.
This task set PIP_INDEX_URL so that this feed can be used later.
|
/azp where |
|
Azure DevOps orgs getting events for this repository: |
| include: | ||
| - '*' | ||
| exclude: | ||
| - 'release' |
There was a problem hiding this comment.
The public pipeline does not have the permission to run PipAuthenticate@1 task, so skip it. This also saves some resource during CLI release.
| CLI_VERSION=`cat src/azure-cli/azure/cli/__main__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g` | ||
|
|
||
| # PIP_INDEX_URL env must exist in `docker build --secret`, use an empty string if it doesn't exist. | ||
| export PIP_INDEX_URL=${PIP_INDEX_URL} |
There was a problem hiding this comment.
Error message without empty env during docker build: ERROR: failed to stat PIP_INDEX_URL: stat PIP_INDEX_URL: no such file or directory
azure-pipelines.yml
Outdated
| condition: eq(variables['Build.SourceBranch'], 'refs/heads/release') | ||
| displayName: 'Pip Authenticate' | ||
| inputs: | ||
| artifactFeeds: ${{ variables.AZURE_ARTIFACTS_FEEDS }} |
There was a problem hiding this comment.
Other tasks use macro syntax as $(variables.AZURE_ARTIFACTS_FEEDS). Does template expression syntax work here?
My understanding is that ${{ variables.AZURE_ARTIFACTS_FEEDS }} only works for templates: https://learn.microsoft.com/en-us/azure/devops/pipelines/process/templates?view=azure-devops&pivots=templates-includes#variable-reuse
There was a problem hiding this comment.
You're right, the variable defined in ADO UI is empty when use ${{ variables.AZURE_ARTIFACTS_FEEDS }}. I've changed to $(AZURE_ARTIFACTS_FEEDS)
Use Azure Artifacts feeds in release branch build process: PyPI, MSI, ZIP, DEB, and RPM
The public pipeline still uses PyPI as it's hard to keep the CFS feed token secret.
Ref: