Skip to content

AllowFailure

Configuration for job failure tolerance.

Use allow_failure to determine whether a pipeline should continue running when a job fails.

Example

To let the pipeline continue running subsequent jobs, use allowFailure(true):

val test by job {
    script {
        shell("exit 1")
    }
    allowFailure(true)
}

Example: exit codes

You can also allow failure only for specific exit codes:

val test by job {
    script {
        shell("exit 137")
    }
    allowFailure {
        onExitCode(137)
    }
}

External resources

Functions

onExitCode

fun onExitCode(code: Int)

Specifies which exit code is allowed to fail.

If the job fails with this exit code, it will be considered successful (with a warning).

Example
allowFailure {
    onExitCode(137)
}
External resources

toYaml

open override fun toYaml(): Yaml

Converts this object into a Yaml object.