Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Trigger bitbucket pipeline manual step using API

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

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!"

Hi Andrew,

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

Where can I get them ?

 

Thanks

PUSH, also need this!!!

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

 

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

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.

This is over one year old, any update atlassian

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

⭐ Calling all Bitbucket and DevOps experts: Special showcase opportunity ⭐

Hi, Bitbucket community! Are you a DevOps practitioner (or know one in your network)? Do you have DevOps tips, tricks, or learnings you'd like to share with the community? If so, we'd love to hea...

1,477 views 4 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you