Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Cannot trigger custom bitbucket pipeline via API request

Edited

Although, I've been through many of the related questions here, I cannot figure out what I'm doing wrong.

I've set up a test repository at https://bitbucket.org/<my-workspace>/<my-test-repo>.

Then I've added a custom pipeline (bitbucket-pipelines.yml)

image: atlassian/default-image:3

pipelines:
custom:
configure:
- variables:
- name: TENANTS
- name: STAGE
- step:
name: configure-create-and-campus
script:
- chmod +x scripts/reconfigure.sh
- scripts/reconfigure.sh some
- scripts/reconfigure.sh other

Triggering the pipeline manually from the Bitbucket Admin Interface works.

Then I've created an Access Token for the repo with pipeline:write permissions.

Then I've tried to query against the Bitbucket API endpoint, like stated in your REST API Docs via Postman. The Authorization Bearer Token has been added.

Endpoint: https://api.bitbucket.org/2.0/repositories/<my-workspace>/<my-test-repo>/pipelines/

My request body looks like so

{

"target": {

"ref_type": "branch",

"type": "pipeline_ref_target",

"ref_name": "master",

"selector": {

"type": "custom",

"pattern": "Using parameter for tenants"

}

},

"variables": [

{

"key": "TENANTS",

"value": "[\"codeversity.com\",\"sycademy.com\",\"heartbase.at\",\"tangoamadeus.com\", \"verbund.sycademy.com\",\"kaidoo.com\",\"blockademy.net\",\"oecademy.codeversity.com\",\"neeom.codeversity.com\",\"hb-tischler.heartbase.at\"]"

},

{

"key": "STAGE",

"value": "testing"

}

]

}

Unfortunately, the request I get is always

{

"error": {

"message": "Bad request",

"detail": "bitbucket-pipelines.yml not found.",

"data": {

"key": "result-service.pipeline.yml-not-found",

"arguments": {}

}

}

}

 

Any ideas? 

Any help much appreciated! 🙌

2 answers

1 accepted

0 votes
Answer accepted

I found the solution - and I have to admit, that it pretty obvious 🙈

I have set the wrong pipeline name as a pattern:

pipelines:
custom:
configure: <-- this is the pipe name
...

so the request body should be

{

"target": {

"ref_type": "branch",

"type": "pipeline_ref_target",

"ref_name": "master",

"selector": {

"type": "custom",

"pattern": "configure" <-- this is where the name goes

}

},
...
}

Maybe this helps someone!

0 votes
Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 20, 2023

@Flo Ragossnig hi. 

This is a good idea to start using pipes. Here is an example of using a trigger-pipeline pipe:

  - pipe: atlassian/trigger-pipeline:5.3.0
    variables:
      BITBUCKET_USERNAME: $BITBUCKET_USERNAME
      BITBUCKET_APP_PASSWORD: $BITBUCKET_APP_PASSWORD
      REPOSITORY: 'your-awesome-repo'

 

To discover more pipes, visit our Bitbucket Pipes Marketplace.

Regards, Igor

Thanks, I've read this but unfortunately this does not solve the problem. I have set up everything already, it just does not work.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events