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

Curl payload request to trigger a pipeline

Hi community

I want to send a curl request to trigger a pipeline in one of the repositories we managed, the curl command is this, based on the api reference docs https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pipelines/#trigger-a-custom-pipeline-with-variables 

curl -X POST -is -u "$BITBUCKET_USERNAME":"$BITBUCKET_APP_PASSWORD" \
--header 'Content-Type: application/json' \
https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/pipelines/ \
--data '
{
"target": {
"ref_type": "branch",
"type": "pipeline_ref_target",
"ref_name": "develop",
"selector": {
"type": "custom",
"pattern": "Deploy to integration"
}
},
"variables": [
{
"key": "NAMESPACE",
"value": "enrx_org_013"
},
{
"key": "URL",
"value": "https://api.xx.xxx.net/"
},
{
"key": "KID",
"value": "xxxxx"
}
],
"WAIT": true
}'

 But I got this error

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

It is like the `bitbucket-pipelines.yml` wouldn't exist in the repository where I am trying to trigger the pipeline, but it does. Could be that apparently the payload I am providing on the curl command is incorrect in  somehow?
How can I get this curl request properly formed?

1 answer

1 accepted

0 votes
Answer accepted

Got it. At the selector attribute, in the `pattern` sub key I had to provide the name of the existing pipeline on `bitbucket-pipelines.yml` file I want to be called to be executed on the request.

I was doing this 

"selector": {
"type": "custom",
"pattern": "Deploy to integration"
}

 I need to do this


```
"selector"
: {
     "type": "custom"
     "pattern": "<pipelinename-to-be-called>"
}
```

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events