0

The below script is to trigger pipeline in Azure devops via REST, Its working fine on an existing pipeline, but when trying on newly created pipeline which has never ran then its throwing below error. Any help or suggestion would be really appreciated.

{"$id":"1","innerException":null,"message":"No pool was specified.\nUnexpected parameter 'pool'","typeName":"Microsoft.Azure.Pipelines.WebApi.PipelineValidationException, Microsoft.Azure.Pipelines.WebApi","typeKey":"PipelineValidationException","errorCode":0,"eventId":3000}
#!/bin/bash

echo "Enter PAT Token"
read -r PAT

echo "Enter Organization name"
read -r OrganizationName

echo "Enter Project ID"
read -r projectId

pipelineId=$(jq -r '.id' PipeOutput.txt)  #Get definition ID from external TXT file

"Trigger_Pipeline=$(curl --write-out "%{http_code}\n" -X POST -L \
-u  :"$PAT" "https://dev.azure.com/""${OrganizationName}""/""${projectId}""/_apis/pipelines/""${pipelineId}""/runs?api-version=6.0-preview.1" \
-H  "Content-Type: application/json" \
-H  "Accept: application/json" \
-d '{
    "resources": {
        "repositories": {
            "self": {
                "refName": "refs/heads/master"
            }
        }
    }
}' --output Triggeroutput.txt --silent)"
echo "Output: $(Trigger_Pipeline)"

1 Answer 1

0

I tested this REST API with the newly created classic pipeline and YAML pipeline, it works fine on both pipelines.

For us to investigate this issue further, please share the YAML file of the newly created pipeline definition.

In addition, please also try with the following steps:

  • Try execute the REST API with another method to see if it work, such as on Postman client.
  • Try to manually trigger this new pipeline to see if it can work.
  • If the manual trigger works, try using the REST API trigger again.
Sign up to request clarification or add additional context in comments.

5 Comments

Thats weird I just tested with postman and its failing for me now, I am using the example azure-pipeline.yaml code from MS azure https://github.com/MicrosoftDocs/pipelines-java
My Aim here is to write a BASH script to automate the Azure Devops, I have completed till creation stage, but when trying to trigger the newly created pipeline via REST its giving error. Through manual trigger its working fine, but when trying to run via rest its failing. Also if I run the pipeline manually and again then trigger the same script then its triggering the pipeline, but newly created ones are giving error
Hi @Vishal, What is the Region of the organization where the problem occurs on? You can go to Organization Settings > Overview to check the organization Region. Does the same issue occurs on your other organizations?
I am trying this in India region, haven't tried in any other region
Hi @Vishal, I tried the same REST API to trigger new pipelines in different organizations within different regions, but never reproduced the issue same as yours. Everything worked fine, all the pipeline can be triggered without any error. It's very odd why your issue occurs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.