Job

A single execution step in a pipeline.

Jobs are instantiated using the job factory. See its documentation for more information.

Properties

Link copied to clipboard

The name of this job, as it appears in the GitLab UI.

Link copied to clipboard
val stage: Stage? = null

The Stage this job is a part of.

Functions

Link copied to clipboard
fun afterScript(block: CommandDsl.() -> Unit)

Adds commands to execute after the main script of this job.

Link copied to clipboard
fun artifacts(configuration: Artifacts.() -> Unit)

Declares paths that will be saved at the end of the job, and can later be consumed by other jobs in the same pipeline.

Link copied to clipboard
fun beforeScript(block: CommandDsl.() -> Unit)

Adds commands to execute before the main script of this job.

Link copied to clipboard
fun cache(configuration: Cache.() -> Unit)

Declares paths that will be reused between different jobs, even if they are of different pipelines.

Link copied to clipboard
fun coverage(regex: String)

Declares a regular expression to configure how code coverage is extracted from the job output. The coverage is shown in the UI if at least one line of the job output matches regex.

Link copied to clipboard
fun dependsOn(job: Job, artifacts: Boolean = false, optional: Boolean = false)

This job will wait until job has terminated.

Link copied to clipboard
fun image(name: String, version: String = "latest", configuration: ContainerImage.() -> Unit = {})

The container image used to execute this job.

Link copied to clipboard

Determines whether this job can be safely canceled after it has started.

Link copied to clipboard
fun retry(max: Int, configuration: Retry.() -> Unit = {})

Configures how many times a job is retried if it fails. If not defined, defaults to 0 and jobs do not retry.

Link copied to clipboard
fun script(block: CommandDsl.() -> Unit)

Adds commands to execute in this job.

Link copied to clipboard
fun service(name: String, version: String = "latest", configuration: ContainerService.() -> Unit = {})

Additional container images used by this job.

Link copied to clipboard
fun tag(name: String)

Adds a tag to this job.

Link copied to clipboard
open override fun toYaml(): Yaml

Converts this object into a Yaml object.

Link copied to clipboard

Logs in the current job to the GitLab Container Registry.

Link copied to clipboard
fun Job.useDockerInDocker(dockerVersion: String = "20.10", dockerInDockerVersion: String = "-dind")

Configures the current job to use the docker command using Docker In Docker.

Link copied to clipboard

Enables the Gradle plugin.

Link copied to clipboard
fun variable(name: String, value: String)

Declares an environment variable that will be available for the entire length of the job.