Skip to content

az pipelines build queue should allow passing of template parameters #17196

@kartsm

Description

@kartsm

Is your feature request related to a problem? Please describe.

I have a build pipeline defined in an azure-pipelines.yml file that I would like to be able to launch with user inputs in the Azure DevOps web UI. We are anticipating turning this pipeline into something of a service catalog item for our internal IT organization.

What the UI and YAML call "parameters" seems to be the natural choice for soliciting and validating user inputs before the build is launched. (What the UI and YAML call "variables" do not actively solicit input, but if you look for them they are there.)

I was researching how to queue builds with both "parameters" and "variables" (as they are known in the Azure DevOps web UI; the builds get API appears to call them templateParameters and parameters respectively). az pipelines build queue appears to offer the setting of "variables" but not "parameters" in its help.

$ az version
{
  "azure-cli": "2.20.0",
  "azure-cli-core": "2.20.0",
  "azure-cli-telemetry": "1.0.6",
  "extensions": {
    "azure-devops": "0.17.0"
  }
}
$ az pipelines build queue --help
This command is from the following extension: azure-devops

Command
    az pipelines build queue : Request (queue) a build.

Arguments
    --branch             : Branch to build. Required if there is not a default branch set up on the
                           definition. Example: refs/heads/master or master or refs/pull/1/merge.
    --commit-id          : Commit ID of the branch to build.
    --definition-id      : ID of the definition to queue. Required if --name is not supplied.
    --definition-name    : Name of the definition to queue. Ignored if --id is supplied.
    --detect             : Automatically detect organization.  Allowed values: false, true.
    --open               : Open the build results page in your web browser.
    --org --organization : Azure DevOps organization URL. You can configure the default organization
                           using az devops configure -d organization=ORG_URL. Required if not
                           configured as default or picked up via git config. Example:
                           https://dev.azure.com/MyOrganizationName/.
    --project -p         : Name or ID of the project. You can configure the default project using az
                           devops configure -d project=NAME_OR_ID. Required if not configured as
                           default or picked up via git config.
    --queue-id           : Queue Id of the pool that will be used to queue the build.
    --variables          : Space separated "name=value" pairs for the variables you would like to
                           set.
# ... rest of output omitted ...

Describe the solution you'd like

Please extend the az pipelines build queue command to pass "parameters" to the queued build. On the command line this might look like:

$ az pipelines build queue --definition-name quux-garply --variables foo=bar zot=blurfl --template-params corge=wibble wobble=baz

When I retrieve the build record I'd like to see something like:

$ az pipelines build show --id 123456
{
  "buildNumber": "20210303.6",
  "buildNumberRevision": 6,
  ...
  "parameters": {
    "foo": "bar",
    "zot": "blurfl"
  },
  ...
  "templateParameters": {
    "corge": "wibble",
    "wobble": "baz"
  },
  ...
}

The various help texts should be updated accordingly.

Describe alternatives you've considered

I have considered custom-crafting the appropriate HTTP requests with curl, and using the Azure DevOps Python SDK. In terms of long-term maintenance by humans, a solution in the CLI seems to be the best way to express intent. I consider it clearer than either hand-crafting a complex JSON request body or writing custom Python code.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions