Unable to start pipeline using atlassian/trigger-pipeline:5.1.0 OR REST API
Asked by Mariusz Dullak:

I have 3 repos in single project: A, B and C.

When there are changes in A or B I need to build dockers from source code and then I want to deploy the code using docker-compose residing in C.

So:

running it manually works (commits to A or B are causing builds), manual running C afterwards works.

I figured out I will use trigger-pipeline:5.1.0 to trigger appropriate pipeline (branch dependent) in C which will deploy what I want where I want.

So my pipeline in A or B calling C is:

```
- step:
name: Deploy
script:
- pipe: atlassian/trigger-pipeline:5.1.0
variables:
BITBUCKET_ACCESS_TOKEN: ${REPO_C_TOKEN_AS_SECRET_VARIABLE}
REPOSITORY: 'C'
REF_NAME: ${BITBUCKET_BRANCH}

```

Obviously I want to run the same branch like the one that is calling here (develop to be specific). I am getting:

```
Account, repository or branch doesn't exist. 

```

all the time.

I tried setting REF_NAME: to develop manually, no changes. Both my pipelines definitions have branches: develop

I tried setting TOKEN to: pipeline Read, pipeline Read, Write, repo Read, repo Read, Write.

Still nothing.

DEBUG: true does not provide any meaningful info. I have checked for typos and I can not see any

```
Status: Downloaded newer image for bitbucketpipelines/trigger-pipeline:5.1.0
DEBUG: Starting new HTTPS connection (1): bitbucket.org:443
DEBUG: https://bitbucket.org:443 "GET /bitbucketpipelines/official-pipes/raw/master/pipes.prod.json HTTP/1.1" 200 None
DEBUG: Starting new HTTPS connection (1): api.bitbucket.org:443
DEBUG: https://api.bitbucket.org:443 "POST /2.0/repositories/companyName/C/pipelines/ HTTP/1.1" 404 61
? Account, repository or branch doesn't exist.
```

<br />

Any ideas what am I missing?


Answers:
author: Mariusz Dullak
body: Problem solved. Almost, as I strongly believe this is a bug and should be either fixed to mentioned in the documentation.

The repo name HAS TO be lowercase. No matter what the real name is, in the REST API call and in the pipe it has to be lowercase.

So if your repo is: ThisIsMyCoolRepo you need to call

API call: <https://api.bitbucket.org/2.0/repositories/espera-werke/thisismycoolrepo/pipelines>'

in the pipe:

REPOSITORY: thisismycoolrepo

For other endpoints you can you whatever case (just like with any web address) but with pipelines it HAS TO be lowercase or it will fail.

comments: author: Oleksandr Kyrdan
body: Hi [@Mariusz Dullak](/t5/user/viewprofilepage/user-id/4697927)

Thanks for your contributing to the community! Good catch!

We'll investigate the issue and notify you.

Additionally, depends of your configuration of the permissions on the account, workspace, project, try to add combination of: \`account:read\` and/or \`workspace:read\` and/or \`project:read\`.

Best regards,  
Oleksandr Kyrdan


author: Mariusz Dullak
body: pipeline write is needed to start pipeline if I am not mistaken since you are going to create new pipeline instance.

I did not spent too much time drilling down to exact requirements.


author: Oleksandr Kyrdan
body: yep, base required permissions are \```Pipelines:Write``` and \```Repositories:Read```

and  
depends of your configuration of the permissions on the account, workspace, project, try to add combination of: \`account:read\` and/or \`workspace:read\` and/or \`project:read\`


author: Oleksandr Kyrdan
body: Thanks for contributing to the community!


author: Oleksandr Kyrdan
body: Hi [@Mariusz Dullak](https://community.atlassian.com/t5/user/viewprofilepage/user-id/4697927)

A new version of the pipe with your suggestion is released:

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

Thanks for contributing to the community!

Best regards,  
Oleksandr Kyrdan


author: Mariusz Dullak
body: So I created repo token with all the privileges and tried curl.

The reply is:

```
{
  "type": "error",
  "error": {
    "message": "Resource not found"
  }
}
```

It looks like pipeline endpoint does not return anything meaningful. I can curl commits, pull request, etc. but not pipelines. Why ?


Tags: bitbucket-cloud

bitbucket-pipelines

cloud