azure-devops-cli-extension icon indicating copy to clipboard operation
azure-devops-cli-extension copied to clipboard

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

Open jayman-dalal opened this issue 3 years ago • 1 comments

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

jayman-dalal avatar Apr 23 '21 12:04 jayman-dalal

@gauravsaralMs Is this being prioritized? We encountered the same problem.

rguptar avatar May 25 '22 21:05 rguptar