Azure / azure-cli-extensions

Public Repository for Extensions of Azure CLI.
https://docs.microsoft.com/en-us/cli/azure
MIT License
379 stars 1.19k forks source link

Unclear how to use --artifact-metadata-list #1632

Open pettys opened 4 years ago

pettys commented 4 years ago

I'm having trouble discovering what to use for --artifact-metadata-list. The descriptions on this page seem vague. It would be really helpful to have some examples, or some way to learn how to use this parameter to specify which pipeline run output I want to create a release for.

So I'm trying to "az pipelines release create" but am stuck getting the error,

"Cannot retrieve the default version for artifact 'MyMobile Builds' because default version type is 'selectDuringReleaseCreationType'"

I found this, which defines ArtifactMetadata, but how to use this is still unclear. https://docs.microsoft.com/en-us/rest/api/azure/devops/release/releases/create?view=azure-devops-rest-5.0#artifactmetadata

I'm trying different incantations of things like --artifact-metadata-list id=172, trying to guess how it works, but no luck.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

yonzhan commented 4 years ago

pipelines

michaelstaszewski commented 4 years ago

Add me to the list. I'm using the REST API to create a release and also have an artifact set to specify the version at time of creation. In my case the artifact is sourced from a universal feed and it's populated from another pipeline in another organization. Using latest version works as does setting my Release pipeline to trigger automatically when a new artifact version is published to the feed, but I'd like to trigger the release from the REST API and seed the version of the artifact to use. The documentation is not clear on how to do this. Thanks!

EDIT: I realize the question is in reference to Azure CLI, but I hope that whatever answers apply to the CLI would help others using REST API as well.

viclin-msft commented 4 years ago

Related:

EugenMayer commented 3 years ago

Same issue here, not sure how to use and what the actual usage scope is.

I assume that releases might be one of the primary goals for manual automation in a azure pipeline, since usually builds have their automated triggers.

By manual automation i mean, tools that do somethine in a custom cascade, on a specific condition or even external button press if you will - or do releases as batch on several pipelines at once, using the same variable input.

As far as i can see, providing any variable is impossible using az pipelines which i assume this question is also all about. Being that the case, it becomes an entire road blocker for such tools. I hope this can be changed over time

gbd77rc commented 3 years ago

Hi I have the same issue here. How do you specify the artifact versions for the release pipeline creations.

az pipelines release create --artifact-metadata-list "$($artifactList.Trim())" --definition-name $releasePipeline --description "$($currentSprint) Release" --organization $organization --project $project

The artifactList is this string

“_sdb_build=600 _iac_build=599 _sdb_transforms_build=597 _ans_build=596 _ext_build=595”

The alias is Source Alias in the Release Pipeline Artifacts. I have tried the Source (build pipeline) as well, but I always get this error message.

Cannot retrieve the default version for artifact '_ans_build' because default version type is 'selectDuringReleaseCreationType'

Has anyone used this command to kickoff a new release with artifact version being specified? should I select a different default version type? If so, which one?

Thanks for any help

Richard....

BharathMannem commented 2 years ago

I am able to get it success after using like this

az pipelines release create --artifact-metadata-list “_sdb_build=600" --artifact-metadata-list "_iac_build=599" --definition-name $releasePipeline --description "$($currentSprint) Release" --organization $organization --project $project

praduman1417 commented 1 year ago

Can we pass "RELEASE" variables using this option ???

odiosdado-msft commented 1 year ago

Can we pass "RELEASE" variables using this option ???

It does not currently support passing variables. See here for reference in code, variables is not an input to the command and thus is never passed to create the release.

https://github.com/Azure/azure-devops-cli-extension/blob/7fc9bfc19c61876ebf7e12eb23f55b38d2bdc78e/azure-devops/azext_devops/dev/pipelines/release.py#LL55C15-L55C35

aarondandy commented 11 months ago

I think this may also be related to https://github.com/Azure/azure-cli/issues/25732