Understanding Error, Simple, Command, and Build logs lines, and Script Task status codes in Bamboo build logs
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
This knowledge base article aims to demystify the significance of various prefixes observed in Bamboo build logs, such as "error", "simple", "command", and "build". Users often encounter these terms in their build logs and may find it confusing, especially when a build marked as successful contains numerous lines starting with "error". This article provides insight into what these prefixes mean and explains the conditions under which a Bamboo build is considered successful or failed, despite the presence of "error" lines in the log.
Solution
Build logs can be found at Build Result > Logs > View.
The "error", "simple", "command", and "build" lines in Bamboo logs correspond to different types of log entries, each serving a specific purpose:
Simple
Indicates generic messages used for informative purposes, often seen in tasks like Checkout. Example: build task initiation and completion messages.
simple 03-Jun-2024 07:32:07 Remote agent on host 127.0.0.1 [...]
simple 03-Jun-2024 07:48:05 Finished task [...]
simple 03-Jun-2024 07:48:05 Finalising the build [...]
Build
Represents outputs from the build processes and standard output (file descriptor 1).
build 03-Jun-2024 07:32:12 JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto [...]
build 03-Jun-2024 07:48:05 Stack UPDATE_COMPLETE [...]
Command
Associates with tasks run on the agent, like variable substitution or external process execution.
command 03-Jun-2024 07:32:07 Substituting variable: ${bamboo.working.directory} with[...]
command 03-Jun-2024 07:32:07 Beginning to execute external process[...]
Error
Denotes build errors or outputs not directed to standard output (stdout). These lines typically indicate a problem with the task execution or a non-zero return code from a Script Task.
error 13-Jun-2024 19:23:43 bash: tauch: command not found
error 12-Jun-2024 04:43:40 Failing as no matching files has been found and empty artifacts are not allowed.
error 12-Jun-2024 04:43:40 Unable to publish artifact [Package Artifacts]:
error 12-Jun-2024 04:43:40 The artifact is required, build will now fail.
Other considerations
Script Tasks
- When talking about Script Tasks, a build (or specific task) can contain "error" lines yet be marked as successful if the last command executed within the Script Task returns a 0 (success) status code. This is because Bamboo considers the status code of the last command inside a Script Task as the exit code to determine that particular task's success or failure.
- A zero exit code signifies success, while any non-zero exit code denotes failure.
- If the script contains error lines due to a non-zero status code but ends with a zero status code (from its last command executed), the task is still considered successful. For example, the final command being an
echo
command (returns 0), the task, and potentially the build, will be marked as successful, regardless of any errors preceding it. - To ensure the Script Task status accurately reflects the desired outcome based on your script's logic, consider adjusting the script's final status to return an appropriate exit code based on the success or failure conditions of your use-case.
Debug mode
- In a Script Task, when debug mode is enabled in your script, each step executed will display with a "+" sign, indicating the action being taken at that moment. All the debug lines revolving around a single command will be prefixed by "error" if the exit status of that command is different than 0.