-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
{C} Use Azure Artifacts feeds in release branch #29866
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
Packaging |
@@ -16,6 +16,7 @@ docker build \ | |||
--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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
env
parameter 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This task set PIP_INDEX_URL
so that this feed can be used later.
/azp where |
Azure DevOps orgs getting events for this repository: |
@@ -6,6 +6,8 @@ trigger: | |||
branches: | |||
include: | |||
- '*' | |||
exclude: | |||
- 'release' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The public pipeline does not have the permission to run PipAuthenticate@1
task, so skip it. This also saves some resource during CLI release.
@@ -11,11 +11,15 @@ set -exv | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: