Is there a list of Bamboo exit codes
Asked by Kris Andrews:

I've been assigned to get a Bamboo build plan running. Last time this ran successfully was back in 2018. Here in 2021, it is aborting with the following message.

build 06-Aug-2021 11:17:48 PHPUnit 4.8.36 by Sebastian Bergmann and contributors.

build 06-Aug-2021 11:17:48

build 06-Aug-2021 11:17:48 Runtime: PHP 7.4.21 with Xdebug 3.0.4

build 06-Aug-2021 11:17:48 Configuration: /home/cmbuild/bamboo-agent-home/xml-data/build-dir/DER-QDB-JOB1/xr/AutomatedTesting/xr/phpunit.xml

build 06-Aug-2021 11:17:48

build 06-Aug-2021 11:17:48 Code coverage needs to be enabled in php.ini by setting 'xdebug.mode' to 'coverage'

simple 06-Aug-2021 11:17:48 Failing task since return code of \[/bin/sh /home/cmbuild/bamboo-agent-home/temp/DER-QDB-JOB1-232-ScriptBuildTask-727917307105596510.sh\] was 2 while expected 0

simple 06-Aug-2021 11:17:48 Finished task '**++Run PHP UnitTests++**' with result: Failed

I'm no wizard with Bamboo, and I know there's a lot to focus on with what I included above, but I want to focus on this statement:

simple 06-Aug-2021 11:17:48 Failing task since return code of \[/bin/sh /home/cmbuild/bamboo-agent-home/temp/DER-QDB-JOB1-232-ScriptBuildTask-727917307105596510.sh\] was 2 while expected 0

In addition to resolving the error, I'm learning. I'm investigating these error codes. So, I asked our Bamboo admins for assistance on these error codes, I received the following:

**Failing task since return code of \[** **/bin/sh /home/cmbuild/bamboo-agent-home/temp/DER-QDB-JOB1-232-ScriptBuildTask-727917307105596510.sh\] was 2 while expected 0**

If we split the URL

1. **/bin/sh**
   1. is an executable the represents the system Shell (Bash)
2. **home/cmbuild/bamboo-agent-home/temp/DER-QDB-JOB1-232-ScriptBuildTask-727917307105596510.sh**
   1. The above path represents the location where exactly your build is working in the Server/Agent i.e, your code is downloaded into this path and is getting build.
   2. Only admins have access to view.
3. **was 2 while expected 0**
   1. 2, 0 are codes, there are referred to as Bamboo Exit codes. Bamboo publicly provides a list of exit codes to describe the error precisely in the form of codes.
   2. Please find the exit codes over the internet.

As suggested, I searched for these 'exit codes' and I cannot find them. I can find posts on how to call them, bypass them, change them, not a list of the codes and their descriptions. Perhaps I'm not understanding the admin's response, or using the correct search key words.

Bottom line, here's my question;

Is there a list of Bamboo exit codes? If so, where can I find them? Maybe, these exit codes are unique to the object or routine being executed, and not to Bamboo?

I apologize for the length of my question. I thought it helpful to provide as much context as possible.

Thanks in advance for help anyone can provide.

Here's my script from the Bamboo plan:

cd ${bamboo_build_working_directory}/xr/AutomatedTesting/xr/

../../vendor/bin/phpunit -c phpunit.xml --verbose --log-junit results/xr_results.xml --coverage-clover=results/xr_coverage.xml phpunit


Answers:
author: Charlie Misonne
body: Hi Kris,

There is no list of Bamboo build exit codes that I'm aware of.
> In addition to resolving the error, I'm learning. I'm investigating these error codes. So, I asked our Bamboo admins for assistance on these error codes, I received the following:

You're right about that.

So you will need to find out why phpunit exits with 2.

What I often do when troubleshooting those kinds of issues is running every command from the build manually on the build agent one by one.  
You could also try enabling more logging for phpunit. There's probably a flag for that.

comments: author: Kris Andrews
body: Thank you for the input. My next step was to manually run the command. I found the initial PHP program which gets executed. I was going to execute that manually and review the output.


author: Charlie Misonne
body: Hi Kris,

Out of curiosity: were you able to pinpoint the issue?