Layout of Job as Code configuration file
Using the Job-as-Code plug-in, you can configure a job step as a JSON or YAML file.
With this approach you are able to track the changes done to the job steps by maintaining the configuration file by version in an SCM repository. The configuration file must be saved on the same workstation that the Build server is installed on.
Layout of the configuration file
The configuration can be file either in
JSON or YAML format. The file can contain more or more steps. Nested steps are not supported.
- If using a JSON file, identify the beginning of the steps with "steps";.
Each step is separated by a comma. The following example, shows the layout of the JSON file.
{ "steps"; [ {step 1}, {step 2}, .... {step n} ] } - If using a YAML file, identify the beginning of the steps with steps:.
Each step begins with a dash. The following example shows the layout of the YAML
file.
steps: -step 1 -step 2 .... - step n
Each step contains properties that define the task.
- name
- The name of the step. This property is required.
- stepType
- The type of step. This property is required.
- description
- A description of the file.
- workDirOffset
- The working directory to use when this command runs. Specify the directory relative to current working directory.
- envVars
- Environment variables in format: variable_name=value pair.
- active
- Specify to temporarily deactivate the step. The default value is for the step to be active.
- runInParallel
- Specify to run this step at the same time as other steps marked as parallel. The default value is do not run in parallel.
- runInPreflight
- Specify to run this process only in preflight processes. The default is to run in preflight processes.
- runInPreflightOnly
- Specify to run this step only in preflight processes.
- preCondition
- The pre-condition script which must pass before the step is run.
- ignoreFailures
- Specify for this step to not affect other steps to run or determine the status of the job. The default value is the step does not affect the job or other steps.
- Post-processing script
- A script for determining when commands of this step should count as fail or succeed.
- timeout
- The number of minutes after the step starts, before it is marked as timed out and aborted. The default value is 0 meaning the step does not timeout.
- properties
- A list of properties that are based on the configured step type. Specify the properties as a property name value pair.
The following example shows the JSON file layout with properties:
The
following example shows the YAML file with
properties:
[
{
"name":"step_name",
"stepType":"step_type",
"description":null,
"workDirOffset":"",
"envVars":"",
"active":"true",
"runInParallel": false,
"runInPreflight":true,
"runInPreflightOnly":false,
"preCondition":"",
"ignoreFailures":"false",
"postProcessScript":"",
"timeout":"0",
"properties":
[
{"key":"", "value":""}
steps:
-name: step_name
stepType: step_type
description: null
workDirOffset: ""
envVars: null
active: true
runInParallel: false
runInPreflight: true
runInPreflightOnly: false
preCondition: null
ignoreFailures:false
postProcessScript:null
timeout":0
properties:
-key: ""
value: ""