Script
To configure a script task:
- Go to the Tasks configuration tab for the job (this will be the default job if creating a new plan).
- Select the name of an existing script task, or select Add task > Script if creating a new task.
In the Task description field, enter a description for the task that will appear in Bamboo.
Check or clear Disable this task to selectively run the task.
Optionally, select Add condition to task to make the task run only when a certain condition is met.
You can find conditions on Atlassian Marketplace or implement your own.
From the Interpreter menu, select one of the available interpreters:
- Shell (chooses the interpreter based on the first line of the script, typically using the shebang)
- Windows PowerShell
- /bin/sh or cmd.exe (uses the default shell of the operating system: sh for Linux, cmd.exe for Windows)
From the Script location menu, select the location of the script file:
- File — enter the location of the file in the Script file field. This can be either relative to the repository root of the plan, or absolute. You can include variables (see Bamboo variables).
- Inline — enter the script in the Script body field.
In the Script body field, enter or paste the code of your script using the syntax appropriate for the selected interpreted.
In the Argument field, specify an argument to pass to the script.
Arguments containing spaces must be quoted. You can include variables (see Bamboo variables).
Optionally, in the Environment variables field, specify additional system environment variables that you want to pass to your build.
- Separate multiple variables with spaces. Parameters values containing spaces must be quoted, for example:
ANT_OPTS="-Xms200m -Xmx700m"
- Existing environment variables are automatically available to the executable. You can also include Bamboo global or build-specific variables.
- If the specified Bamboo variable is present during the task execution, the created environment variable will be set to its value. Declared variable values are passed to the task verbatim, which means that they will not get parsed by any other method and will be sent to the script as a literal string. Hence, no further variable expansion is performed. If you want to assign a script variable using the contents from another variable, do that internally within the script task. Learn how to load variables from within a script task
- Separate multiple variables with spaces. Parameters values containing spaces must be quoted, for example:
Optionally, in the Working subdirectory field, specify an alternative subdirectory relative to the root directory of the job where Bamboo will run the executable.
The root directory contains everything checked out from the job's configured source repository. If you leave this field blank, Bamboo will look for build files in the root directory. This option is useful if your task has a build script in a subdirectory and the executable needs to be run from within that subdirectory.
- Select Save.