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

Trigger bitbucket pipeline manual step using API

Tim Myerscough February 1, 2018

Hi

 

As part of my Bitbucket Pipeline, I want to invoke a long running asynchronous process (external to BitBucket).  Once complete, if successful, it would promote the build

 

My pipeline:

 

pipelines: 
default:
-
step:
name: Deploy to test
script:
- yarn install
-
yarn run deploy:test
-
yarn run deploy:verify # triggers asynchronous process
-
step:
name: Verify Deploy
trigger: manual
script:
-
yarn run deploy:post-verify
-
step:
name: Deploy to prod
script:
- yarn install
-
yarn run deploy:prod

 

Can I trigger the `Verify Deploy` stage from code?

4 answers

2 votes
Andrew Lehman May 16, 2019

I've gotten this to work using the Bitbucket API.  The API call used was:

curl -X POST -is -u '$USERNAME:$PASSWORD' \
-H 'Content-Type: application/json' \
https://api.bitbucket.org/2.0/repositories/$USERNAME/$REPONAME/pipelines/ \
-d '{
"target": {
"selector": {
"type": "custom",
"pattern": "hello"
},
"type": "pipeline_ref_target",
"ref_name": "master",
"ref_type": "branch"
}
}'

The bitbucket-pipelines.yml file was:


pipelines:
custom:
hello:
-
step:
script:
-
echo "Hello world!"

Minh Chau May 4, 2020

Hi Andrew,

What are the values for the $USERNAME:$PASSWORD ?

Where can I get them ?

 

Thanks

1 vote
Aidan Samuel September 28, 2020

There's an outstanding request for this feature here: https://jira.atlassian.com/browse/BCLOUD-20050

 

Please add your +1 (via More > Add vote).

tkn98 July 12, 2021

Mark Nelissen mentioned Jul 09, 2021

https://jira.atlassian.com/browse/BAM-21281 this is a better feature request, although directed at Bamboo, but the solution and behaviour expected is actually the same for Bitbucket Pipelines.

Which I gratefully share here as well.

Denis Baltor March 23, 2024

Yikes! Four years on and the feature request is still sitting there. I guess this is just Atlassian being Atlassian.

1 vote
Matthias Posch April 22, 2019

PUSH, also need this!!!

0 votes
Matjaz Jurecic April 5, 2019

This is over one year old, any update atlassian

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events