azureazure-devopsazure-pipelinesazure-pipelines-yamlbuild-triggers

TriggerBuild Could not queue the build because there were validation errors or warnings


I got an azure yaml pipeline I want to trigger via another pipeline.

The original pipeline has parameters defined like this:

parameters:
- name: Param1
  default: val1
  type: string
- name: Param2
  default: val2
  type: string
- name: Param3
  default: val3
  type: string

I'm trying to trigger the pipeline with this step in a different pipeline:

steps:
- task: benjhuser.tfs-extensions-build-tasks.trigger-build-task.TriggerBuild@4
  displayName: 'Ensure trigger is working'
  inputs:
    buildDefinition: My.Original.Pipeline
    waitForQueuedBuildsToFinish: true
    waitForQueuedBuildsToFinishRefreshTime: 5
    password: '$(system.accesstoken)'
    failTaskIfConditionsAreNotFulfilled: true
    buildParameters: |             
            "Param1: ${{ parameters.Param1}}",
            "Param2: ${{ parameters.Param2}}"

I'm passing 2 parameters out of the 3 and want to use the default param value for the 3rd one.

When I run the pipeline, I get this output:

Found parameter "Param1 with value: otherval1"
Found parameter "Param2 with value: othrtval2"
Error during request (1/5)
Error message: Error: Could not queue the build because there were validation errors or warnings.
Will wait 1 seconds before retrying request...
Error during request (2/5)
Error message: Error: Could not queue the build because there were validation errors or warnings.
Will wait 2 seconds before retrying request...
....

What could cause this error?


Solution

  • I can reproduce the same issue when using the same trigger build task definition.

    To pass the runtime parameters to another pipeline in trigger build task, we need to use the templateParameters field and follow the format below:

    templateParameters: >       
              Param1: ${{ parameters.Param1}},
              Param2: ${{ parameters.Param2}}
    

    Or:

    templateParameters: |      
              Param1: ${{ parameters.Param1}},
              Param2: ${{ parameters.Param2}}
    

    YAML sample:

    steps:
    - task: benjhuser.tfs-extensions-build-tasks.trigger-build-task.TriggerBuild@4
      displayName: 'Ensure trigger is working'
      inputs:
        buildDefinition: My.Original.Pipeline
        waitForQueuedBuildsToFinish: true
        waitForQueuedBuildsToFinishRefreshTime: 5
        password: '$(system.accesstoken)'
        failTaskIfConditionsAreNotFulfilled: true
        templateParameters: >       
              Param1: ${{ parameters.Param1}},
              Param2: ${{ parameters.Param2}}
    

    Result:

    enter image description here

    Another pipeline Output:

    enter image description here