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

Is it possible if phpunit test failed on push to block the merge button?

Ivo June 17, 2024

Hi guys, Is that possible to be done in pipeline?

On push we need to run phpunit and if the tests are failing we need to block the merge button.

Below is my simple pipeline:

      steps:
      - step: &build
          name: Build and run Composer
          runs-on: 
            - 'self.hosted'
            - 'linux.arm64'
            - 'customlabel'
        script: 
          - apt update 
          - apt install -y list-of-packages
          - docker-php-ext-enable list-of-extensions
          - docker-php-ext-install list-of-extentions
          - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
          - composer install
          -  ./vendor/bin/phpstan
          -  ./vendor/bin/phpunit          
          - apt-get clean 
          - rm -rf /var/lib/apt/lists/* /tmp/pear
        caches:
          - composer

      pipelines:
        branches: 
          my-branch:
            - step: *build 


Regards,

1 answer

1 vote
Saxea _Flowie_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 18, 2024

Hi @Ivo,

Yes, when your test fails and causes the pipeline to fail, it will mark the build as failed. You can define merge checks for passing builds.

We also provide an addon with build checks and additional merge checks not available on Bitbucket out of the box.

Ivo June 19, 2024

Thank you @Saxea _Flowie_ 

We know about the merge checks and the options but my colleagues are not able to merge:

The message is:


The following recommended pre-merge check did not pass:
1+ approval from default reviewers

They selected from the merge settings

Minimum number of approvals 1

Minimum number of successful builds for the last commit with no failed builds and no in progress builds 1

Regards,

Saxea _Flowie_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 19, 2024
Ivo June 19, 2024

Hi @Saxea _Flowie_ ,

No i haven't selected this option because this option is part of the Premium plan. 
You can see my configuration on the screenshot below. 

 

Screenshot from 2024-06-20 07-16-01.png


Regards,

Saxea _Flowie_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 20, 2024

In order to block the merge using Bitbucket's built in checks you need premium. Flowie can enforce merge checks on non-premium, but is also a paid addon. It does give you other functionality like PR labels, draft, additional checks, rebase support and more. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events