Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

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

pipeline build ran but not shown in the pr

Hod Bauer
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 23, 2024

I have a pipeline that do the following steps:

1. lint

2. test

3. collect coverage

If there is downgrade in one of  the coverage rate it should block the PR.
otherwise it update the threshold and commit it to the already opened PR.

Sometimes although the pipeline is running and finish successfully to push back a commit with the new threshold it not show it anymore in the PR builds.

The pipeline is defined with the following steps:

 - step:
name: Lint and Test
caches:
- node
script:
- npm ci
- npm run lint
- npm run test-coverage
- npm run update-coverage
after-script:
- git config --global user.email "ci-bot@duve.com"
- git config --global user.name "CI Bot"
- git add jest.config.json
- git commit -m "[skip ci] Updating test thresholds based on tests results"
- git push origin HEAD:$BITBUCKET_BRANCH

 

The project is written in js

The script `
update-coverage` run a js code that finish with `process.exit(0);` is there is no errors on run time and `process.exit(1);` if there is any error

1 answer

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 24, 2024

Hi Hod and welcome to the community!

When you open a pull request in a Bitbucket Cloud repo, the builds section in the Overview tab will show the build associated with the last commit in the PR's source branch.

Your pipelines build adds another commit to the source branch and then pushes it back to the Bitbucket repo, so then this commit becomes the last commit of the PR's source branch. If there is no build associated with this commit, then the PR will not show any builds.


What you can do is use our API to post a build status for this commit that you are creating during the Pipelines build:

You could do that either during the Pipelines build or from your own computer.

You will need the commit hash of the commit that is created during the build. You can get that during the Pipelines build and store it in a variable as follows (after you create the commit):

COMMIT=$(git rev-parse HEAD)

Depending on the exit code of the step that creates this commit, you can update the commit's build status accordingly.

If you want to update it during the build, in the after-script of the step, the default variable $BITBUCKET_EXIT_CODE is available which will be 0 for a successful step and 1 for a failed step. Valid values for the build state in the API call are FAILED, INPROGRESS, STOPPED, SUCCESSFUL. You can use the SUCCESSFUL state when the $BITBUCKET_EXIT_CODE is 0 and the FAILED state otherwise.

Please feel free to reach out if you have any questions.

Kind regards,
Theodora

Suggest an answer

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

Atlassian Community Events