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:
steps() - configures the steps for the job
params() - configures job parameters
dependency() - defines job dependencies
outputFiles() - configures output files (share with jobs or publish as artifacts)
repositories() - configures VCS repositories for the job
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
function to initialize the job
See also
Adds a job to the pipeline.
Example:
job(BuildApplication) // 'BuildApplication' object is defined elsewhereParameters
the job to add