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

Bitbucket Pipelines fail upon successfull execution of unit tests

Angelos Naoum March 4, 2024

We have configured a pipeline where we ran some unit tests for a PHP Laravel project which includes the below:

- step:
name: Unit tests
- mysql
image: webdevops/php-nginx:8.2
- composer install --no-interaction --optimize-autoloader --ignore-platform-reqs
- pecl install xdebug
- echo "" >> /opt/docker/etc/php/php.ini && echo "zend_extension = xdebug" >> /opt/docker/etc/php/php.ini && echo "xdebug.mode=coverage" >> /opt/docker/etc/php/php.ini
- php artisan test --coverage-clover tests/reports/coverage/coverage.xml --configuration phpunit.xml
- tests/reports/coverage/**
The unit tests are running successfully, so the pipeline should continue to the next step alhtough upon the successfull execution of the tests, the pipeline fails with no any explanation or any insightful log.

The same setup was working until few days ago.
We also tried to manually re-run a previous successful pipeline and the issue occurrs there too.

1 answer

0 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 5, 2024

Hello @Angelos Naoum ,

thank you for reaching out to the Community!

The way that pipelines identify if a step was successful or not is based on the exit code of the commands being executed. A command that exits with code zero indicates a successful step, while any exit code other than zero will make the step be considered as failed. What may be the case is the command you are executing is returning a non-zero exit code even when the tests are successful, making the pipeline understand it as a failure.

That being said, I see you have also opened a support ticket with us to report this issue, and one of my colleagues is already investigating the affected build. In this case, I would suggest focusing the discussion on the support ticket to avoid any confusion that may arise from discussing the same issue in multiple places.

If you feel comfortable, once the support ticket is resolved, feel free to share the solution here in the Community so other users facing similar issues can try the same solution :)

Thank you, @Angelos Naoum !

Patrik S

Suggest an answer

Log in or Sign up to answer
Site Admin
AUG Leaders

Atlassian Community Events