Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Why receive 400 Bad request for executing custom pipeline API

Michael Brizic August 31, 2020

This is what I execute:

curl -X POST -i -u '<username>:<password>' -H 'Content-Type: application/json' https://api.bitbucket.org/2.0/repositories/<workspace>/<slug>/pipelines/ -d '
{
"target": {
"type": "pipeline_ref_target",
"ref_type": "branch",
"ref_name": "master",
"selector": {
"type": "custom",
"pattern": "increment-build-version"
}
}
}'

This is what I receive:

{"error": {"message": "Bad request", "detail": "bitbucket-pipelines.yml not found.", "data": {"key": "result-service.pipeline.yml-not-found", "arguments": {}}}}

But, I have a bitbucket-pipelines.yml file and custom pipelines defined like so:

pipelines:
custom:
new-start-testflight:
- step:
name: New Test Flight
image: atlassian/default-image:2
script:
- ./prepTestFlight.sh

increment-build-number:
- step:
name: Increment Build Version
image: atlassian/default-image:2
script:
- git remote set-url origin ${BITBUCKET_GIT_SSH_ORIGIN}
- ./incrementBuildVersion.sh

2 answers

0 votes
Marcos Silva December 30, 2022

A little bit late, but in my case, the error was caused due to the custom pipeline didn't exist in the specified branch.

See this other thread for reference https://community.atlassian.com/t5/Bitbucket-questions/Pipeline-trigger-run-fails/qaq-p/2024388

0 votes
ktomk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 7, 2020

The error message is not specifically meaning that the bitbucket-pipelines.yml file would not be there, it does also mean that the pipeline selected is not in that file (at refs/heads/master on the Bitbucket remote).

The pipeline "custom/increment-build-version" according to the yaml you posted can not be found.

I'd assume a misnomer and the pipeline is "custom/increment-build-number" instead (version -> number).

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events