job

fun job(init: Job.() -> Unit): Job

Adds a job to the pipeline.

A job is a unit of work in a pipeline that performs a specific task, such as building, testing, or deploying. Jobs can have dependencies on other jobs, allowing for complex workflows.

The id and name are mandatory properties for a valid job (id can be omitted if it matches the class name).

Job settings are grouped into blocks:

Example. Basic job with build steps

job {
id("build")
name = "Build Application"

steps {
gradle {
tasks = "clean build"
}
}
}

Example. Job with dependencies and parameters

job {
id("deploy")
name = "Deploy Application"

params {
param("env.DEPLOY_ENV", "production")
}

steps {
script {
scriptContent = "./deploy.sh"
}
}

dependency("build")
dependency("test")
}

Return

added job

Parameters

init

function to initialize the job

See also


fun job(job: Job)

Adds a job to the pipeline.

Example:

job(BuildApplication) // 'BuildApplication' object is defined elsewhere

Parameters

job

the job to add

See also