How to add inline script task in Bamboo job using Bamboo Command Line Interface (CLI)

This article explains how to add inline script task in a Bamboo job using Bamboo Command Line Interface (CLI).

Instructions

Use the addTask action to create inline script tasks in the Bamboo job. Refer to the sample command below:

--action addTask --plan DEMO-NEW  --job "JOB1"  --taskKey SCRIPT --description "Scripted Task " --field scriptLocation=INLINE --field scriptBody="exit -1"

In the above action:

  • --plan value refers to a Bamboo plan key.
  • --job value refers to the Bamboo job key.
  • --taskKey value refers to Bamboo task type.
  • --description value refers to task description.
  • --field parameter refers to specific script configuation.
    • --field  scriptLocation=INLINE refers to  inline script type.
    • --field scriptBody="exit -1" refers body of INLINE scripts and " \n " used new lines.
  • Additionally, --disable parameter can be used to disable the task and --final parameter to script task as a final task.

It is recommended to test this scenario in a non-production environment or run the action with --simulate parameter to verify the behavior before deploying.