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

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,462,143
Community Members
 
Community Events
176
Community Groups

Trigger pipeline in another repo

Trying to trigger a pipeline in another repo

The triggering repo has this for its bitbucket-pipelines.yml

options:
  docker: true
pipelines:
  pull-requests:
  '**': #trigger pipeline in gemm_fw
    - step:
      script:
        - pipe: atlassian/trigger-pipeline:5.0.1
          variables:
            BITBUCKET_USERNAME: 'bsteinic'
            BITBUCKET_APP_PASSWORD: 'app-password generated'
            REPOSITORY: 'gemm_fw'
            REF_TYPE: 'branch'
            REF_NAME: 'master'
            #CUSTOM_PIPELINE_NAME: 'pull-requests'
            # [{
            # "key": "BITBUCKET_BRANCH",
            # "value": "${BITBUCKET_BRANCH}"
            # }]
            DEBUG: 'true'
            WAIT: 'true'

Fails with the following:

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/tdwilliamson_ee/gemm_fw/pipelines/ HTTP/1.1" 400 160
✖ Error: {"error": {"message": "Bad request", "detail": "bitbucket-pipelines.yml not found.", "data": {"key": "result-service.pipeline.yml-not-found", "arguments": {}}}}

1 answer

0 votes

@Brett Steinicke  hi. Thanks for your question.

Error says that you do not have bitbucket-pipelines.yml config file in your triggered repo.

Please, check this file preset in repository gemm_fw, and also check that pipelines are enabled in repository gemm_fw.

Regards, Igor.

I do indeed have a bitbucket-pipelines.yml config file in my triggered repo and it is properly formatted and I can trigger a build in that repo via the web interface.
Here is its contents:
options:
  docker: true
image: myusername/docker_uhr_utest
pipelines:
  pull-requests:
    '**': #runs as default for any branch not elsewhere defined
    - step:
      script:
       - set +e
       - git checkout ${BITBUCKET_BRANCH}
       - set -e
       - ./config.sh -b ${BITBUCKET_BRANCH}
       - docker run -v /${BITBUCKET_CLONE_DIR}:${BITBUCKET_CLONE_DIR} --name my_utester -i myusername/docker_uhr_utest /${BITBUCKET_CLONE_DIR}/scripts/run_all_ceed.sh ${BITBUCKET_CLONE_DIR}/.config

Try to trigger the build via API
From your example API has a response 400 with bitbucket-pipelines.yml not found for this url:
https://api.bitbucket.org/2.0/repositories/tdwilliamson_ee/gemm_fw/pipelines/

Try to send request to API without using pipe, in example via CURL in console, and maybe you understand where is the problem.

I think the problem is with ACCOUNT variable. Maybe you have to provide custom account, instead of default 
tdwilliamson_ee

Regards, Igor

Looks like the same failure:

curl -X POST -is -u uname:app-password -H 'Content-Type: application/json' https://api.bitbucket.org/2.0/repositories/tdwilliamson_EE/gemm_fw/pipelines/ -d '
{
"target": {
"ref_type": "branch",
"type": "pipeline_ref_target",
"ref_name": "master"
}
}'
HTTP/2 400
server: nginx
vary: Origin
x-b3-parentspanid: 18a9750f5304a6a0
x-cache: Error from cloudfront
content-type: application/json; charset=utf-8
x-b3-traceid: 204a27e5e59eb40e
x-oauth-scopes: pipeline:write, repository
x-usage-output-ops: 0
x-dc-location: Micros-3
strict-transport-security: max-age=31536000; includeSubDomains; preload
date: Mon, 08 Aug 2022 16:16:50 GMT
x-usage-user-time: 0.089203
x-usage-system-time: 0.005242
x-served-by: c2f9d054706b
x-b3-spanid: 2ac25fdd8140d1b9
x-view-name: bitbucket.apps.proxy.views.proxypass
x-static-version: 25ac997ec994
x-credential-type: apppassword
x-render-time: 0.6703824996948242
x-usage-input-ops: 0
x-frame-options: SAMEORIGIN
x-version: 25ac997ec994
x-request-count: 3662
content-length: 160

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

If I add a section to the bitbucket-pipelines.yml file the build is triggered successfully triggered:

  branches:
    test-branch:
      - step:
          name: Unit Test Pipeline
          script:
- ...

Changed the request to be "ref_name": "test-branch"

So is there a way to trigger a pull-requests entry pipeline build when there is not a created pull-request?

pipelines:
  pull-requests:
    '**': #runs as default for any branch not elsewhere defined
    - step:
      script:

 

"So is there a way to trigger a pull-requests entry pipeline build when there is not a created pull-request?"

According to pipelines config page: 
"If you already have branches in your configuration, and you want them all to only run on pull requests, replace the keyword branches with pull-requests."

So if you don't want to create pull requests, just use branches instead of pull-requests

Suggest an answer

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

Atlassian Community Events