Jobs
Introduction
A job is a sequence of steps to be executed in the pipeline. It is mandatory to define at least one job in the pipeline. You can define the required jobs for the pipeline as key-value pairs using the jobs key.
Apart from the regular jobs defined in the pipeline, you can configure the following jobs as well :
- Approval Job
- Parallel Job
You can retrieve the status of a job by using << status.{stage_name}.{job_name} >>.
Properties of a Job
Key | Value | is Mandatory |
---|---|---|
variables | An array of variables | No |
artifacts | This includes the upload and download keys. Refer to this help page for more details. | No |
notify | This key can be configured to send notification emails about the job before it starts execution and after the job execution completes. Contains the sub-keys on-start and on - end | No |
on-start / on -end | Contains the sub-keys notify-type and notify-variables. | Yes (if notify is used) |
notify-type | Provide the value as email . | Yes (if notify is used) |
notify-variables | Provide the email address to be notified when the job execution starts (for on-start) and the email address to be notified when the job successfully completes execution (for on-end ) | Yes (if notify is used) |
runner | Specify the runner name in which the jobs need to be executed. | No |
image | Specify the name of the image needed for the specific job execution. | No |
cwd | Specify the current working directory in which the job has to be executed. | No |
steps | An array containing the scripts that need to be executed in the pipeline. | Yes |
when | Specify the conditions that determine whether the job has to be executed or not. | No |
YAML Code Snippet for Job
Here’s an example code snippet for jobs that can be defined in a pipeline:
copyjobs: testJob1: steps: - echo "Enter your scripts here" testJob2: variables: BRANCH: main artifacts: upload: - name: artifactTest type: zip location: stratus://mybucket/home/artifacts files: - '**/*' download: - name: artifactTest type: zip location: stratus://mybucket/home/artifacts notify: on-start: - notify-type: email notify-variables: to: amelia.burrows@zylker.com on-end: - notify-type: email notify-variables: to: amelia.burrows@zylker.com runner: runner2 image: testImage1 cwd: cd ./src steps: - echo "Enter your scripts here" and: - equal: - << pipeline.event.branch >> - main - true testJob3: steps: - echo "Hello"
The above code illustrates the following workflow:
- There are three jobs defined in the pipeline - testJob1, testJob2, testJob3.
- The testJob2 is configured to be executed only if the current working branch in the repository is the main branch.
- The testJob2 handles the process to store and retrieve the generated build files to and from Catalyst Stratus. This is defined using the upload and download keys.
- It also sends a notification to the defined email address in order to keep them informed about the start of the job execution and the completion of the job as well. This is acheived using the notify on-start and on-end keys.
Last Updated 2025-05-30 16:54:59 +0530 +0530
Yes
No
Send your feedback to us
Skip
Submit