Bash script does not generate artifact

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

Summary

The purpose of this KB article is to provide potential reasons why this issue may occur and suggest troubleshooting steps to resolve it.

Diagnosis

  • You are executing a build that creates a file via the execution of a bash script, this file is then used to generate an artifact for the build

  • The file seems to be created within your build but it does not show up in the build teardown, and therefore is not considered as a generated artifact

Cause

There are two likely causes behind the issue:

  1. The file is not actually being created by the bash script due to issues with the script

  2. The file is being created by the bash script, but the filename is incorrect due to improper formatting in the bash script

Solution

  1. As a first step, add the ls command in your YML configuration to your build step below the execution of your bash script to check that the artifact has actually been created and is present in the build directory:

    1 ls -l

    a) If the file is present, please proceed with Step 2.

    b) If the file is not present, or is named something else - check your bash script and correct any issues that may be present to allow for the creation of that file with the correct filename.

  2. Test the bash script locally on your machine to verify the file that is generated outside of the Pipelines build environment.

    a) If the generated fileis named differently to what is present in your build logs, please proceed with Step 3.

    b) If the file is the same as your build logs, please contact support or raise a community ticket for further assistance.

  3. Download and install the ShellCheck utility to scan the bash script that is being used in your build to validate it for errors.

    a) If there are errors found in the formatting of the script (for example : improper carriage returns), please proceed with Step 4.

    b) If there are no errors found, please contact support or raise a community ticket for further assistance.

  4. Proceed with executing the suggested command(s) found in the ShellCheck results and push this corrected file back to your repository

    a) For example - the bash script is found to contain literal carriage returns that cannot be interpreted, the suggestion is to run the tr -d '\r' command:

    1 tr -d '\r' < script.sh > fixedscript.sh

If the above instructions do not assist in resolving the issue, please raise a support ticket or raise a community support ticket for further assistance with this.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.