Azure / Azure/azure-devops-cli-extension

Use az devops CLI to run a release pipeline with specific build

Open
#1,122 1 comment 0 reactions 1 assignee Claimed by @roshan-sy View on GitHub
Feature
Dominant language
Python
Stars
682
Forks
278
Avg merge
3d 23h
Merged PRs (30d)
3

Description

It appears that to be able to run a AZ release pipeline with a specific build, we need to be using "--artifact-metadata-list" CLI parameter. However, its usage seems unclear even after looking thru several issues related to that topic (see referenced list below). If I just kick off the release with
`az pipelines release create --definition-id YY --description "Desc" --open`
it does the right thing of picking the latest build (which happens to be 20210421_3_237993) and I get the following json output (showing only the 'artifacts' node')
```
"artifacts": [
{
"alias": "Build",
"definitionReference": {
"branch": {
"id": "BranchNameXXX",
"name": "BranchNameXXX"
},
"branchFilters": {
"id": "",
"name": ""
},
"connection": {
"id": "97f20a89-8878-400d-bf97-4a69d6297fbb",
"name": "CloudVault API - CDPXOfficialBuilds"
},
"definition": {
"id": "020bcc5a-c987-4129-bd6c-e5183ab79a44",
"name": "020bcc5a-c987-4129-bd6c-e5183ab79a44"
},
"localMetadata": {
"id": "",
"name": ""
},
"supportForBranchVersionPickerEnabled": {
"id": "true",
"name": "true"
},
"version": {
"id": "3fa75c15-7444-4e28-b562-a2852887e1b5",
"name": "20210421_3_237993 (BranchNameXXX)"
}
},
"isPrimary": true,
"isRetained": false,
"sourceId": "97f20a89-8878-400d-bf97-4a69d6297fbb:020bcc5a-c987-4129-bd6c-e5183ab79a44",
"type": "CloudVaultArtifacts-v3"
}
],
```

However, if i want to target the specific build verion 20210421_3_237993 (say it was a build in past) created using a build definition id NNN on release id YY (which has name ZZZ) and I use the commands, it does not pick up that build:
```
az pipelines release create --definition-id YY --description "Desc" --open --artifact-metadata-list "Build=237993"
az pipelines release create --definition-id YY --description "Desc" --open --artifact-metadata-list "Build=3fa75c15-7444-4e28-b562-a2852887e1b5"
```
What am I missing?

References:
- https://github.com/Azure/azure-cli-extensions/issues/1632
- https://github.com/Azure/azure-devops-cli-extension/issues/872

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.