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,361,885
Community Members
 
Community Events
168
Community Groups

When the default pipeline is triggered it only takes the last commit into consideration.

I do a modification in my local copy of the repository and commit the change to the local repository into a new branch. Then i do some more corrections and commit those changes to the same branch. Now my local branch has two commits done to two separate files in the repo. Then i push the local branch to the remote repository.

Now the default pipeline gets triggered. But i see that the default pipeline is triggered only one the last commit that was done to the branch and it does not include the first commit.

Depending on what files are changes in a commit i have  change sets in place to trigger different builds in the default pipeline. So when my branch that was pushed contain changes to two different files done in two different commits i expect that both builds would get executed because  there were two changes. But in this case only the last commit was picked and only that build will get executed.

How can I overcome this behaviour, because i need all the builds to be triggered that matches the change sets when i do a push.

Here is an extract of my pipeline:

pipelines:
default: #This will build and push the modified container image
- parallel:
- step: &build_ifs_secrets_handler
name: build_ifs_secrets_handler
script:
- export COMMIT_VERSION=`echo ${BITBUCKET_BRANCH} | sed 's/\///g'`
- HOST_UID=`id -u` TRACE=true ./build_push_secrets.sh
condition:
changesets:
includePaths:
- ifs/secret-handler/**
artifacts: # results of the security scan
- ifs/pipeline_scripts/*.txt
services:
- docker
caches:
- docker
- step: &build_ifs_base_image
name: build_ifs_base_image
script:
- HOST_UID=`id -u` TRACE=true ./build_push_base.sh
condition:
changesets:
includePaths:
- ifs/base/**
artifacts: # results of the security scan
- ifs/pipeline_scripts/*.txt
services:
- docker
caches:
- docker
- trivycache

 

So if my first commit had change done to ifs/secret-handler/** and my second commit had changes done to ifs/base/** i want both pipelines to be triggered when the branch is pushed with those two commits. 

But what happens now is only the second commit gets triggered and only the pipeline build_ifs_base_image gets executed.

1 answer

1 accepted

0 votes
Answer accepted

Hi @Prabha Ranaweera,

In a pull-request pipeline, all commits are taken into account, and if you provide an includePathlist of patterns, a step will be executed when at least one commit change matches one of the conditions.

For other types of pipelines, like the default one you are using, only the last commit is considered. I'm afraid there is no way to change this at the moment.

This is mentioned in our documentation here:

We have a request in our issue tracker to change this and consider all commits of a certain push:

Please make sure to vote and comment on it to give it more weight and further express your interest.

In the meantime, one thing you could do is push commits one at a time. This should be fine for pull request merge commits in your default main branch for example, but if you push multiple commits to a branch at the same time or if you push multiple times to a given branch you might experience non-intuitive behavior when failing pipelines turn green only because the failing step is skipped on the next run.

Kind regards,
Theodora

Thank you for the response. I have voted for https://jira.atlassian.com/browse/BCLOUD-20648. Hopefully this will be taken up and fixed soon.

Regards,

Prabha

Like Theodora Boudale likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

3,499 views 3 10
Read article

Atlassian Community Events