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

Unable to start pipeline using atlassian/trigger-pipeline:5.1.0 OR REST API

Mariusz Dullak
Contributor
April 12, 2023

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.


Any ideas what am I missing?

 

3 answers

1 accepted

1 vote
Answer accepted
Mariusz Dullak
Contributor
April 13, 2023

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.

Oleksandr Kyrdan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 14, 2023

Hi @Mariusz Dullak 

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

Mariusz Dullak
Contributor
April 14, 2023

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.

Oleksandr Kyrdan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 14, 2023

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`

Oleksandr Kyrdan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 30, 2023

Thanks for contributing to the community!

0 votes
Oleksandr Kyrdan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 30, 2023

Hi @Mariusz Dullak 

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 

0 votes
Mariusz Dullak
Contributor
April 12, 2023

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 ?

Suggest an answer

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

Atlassian Community Events