Add a new task to an existing GoCD Job
Now that we have a pipeline with stage(s) containing job(s) we can add tasks to any of the existing jobs. You can now use the tree navigation on the left side of the screen to edit a job under a stage.
- Click on the job name that you want to edit on the tree as shown below.
- Click on “Add new task”. You can choose the task type from Ant, Nant, Rake and Fetch Artifact. Or you can choose “Custom Command” to specify your own command
- Fill the basic settings for the task. For example if you would like to execute
docker build -t image .
command you can do it in two ways (assuming your agent can run docker):- in existing shell
docker
in Command field, and Attribute field each in new line:build
-t
image
.
- or in new shell
/bin/sh
in Command field, and Attribute field each in new line:-c
this attribute tells/bin/sh
that next attribure will be a shell commanddocker build -t image .
- in existing shell
- Click “Save”
- Advanced Options section allows you to specify a Task in which you can provide the actions (typically clean up) that needs to be taken when users chooses to cancel the stage.