Pipeline

Represents TeamCity pipeline, which is a collection of jobs that can be executed in a specific order.

To appear in UI a pipeline should be registered in a project using the pipeline method.

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

Pipeline settings are grouped into blocks:

Example. Pipeline defined as an object with jobs

object DeployPipeline: Pipeline({
id("DeployPipeline")
name = "Deploy Pipeline"

repositories {
main(DslContext.settingsRoot)
}

job("build") {
name = "Build Application"
steps {
gradle {
tasks = "clean build"
}
}
}

job("test") {
name = "Run Tests"
steps {
gradle {
tasks = "test"
}
}
dependency("build")
}

job("deploy") {
name = "Deploy Application"
steps {
script {
scriptContent = "deploy.sh"
}
}
dependency("test")
}
})

Example. Pipeline with VCS root and triggers

pipeline {
id("CIPipeline")
name = "CI Pipeline"

triggers {
vcs {
branchFilter = "+:*"
}
}

job("build") {
name = "Build"
steps {
// job steps
}
}
}

See also

Constructors

Link copied to clipboard
constructor(init: Pipeline.() -> Unit)

Creates a pipeline and initializes it with the specified init block.

constructor()

Properties

Link copied to clipboard
Link copied to clipboard
open override var id: Id?
Link copied to clipboard
Link copied to clipboard

Pipeline jobs

Link copied to clipboard

Pipeline name

Link copied to clipboard

Pipeline output parameters exposed to downstream pipelines and build configurations.

Link copied to clipboard

Pipeline parameters

Link copied to clipboard

Pipeline repositories

Link copied to clipboard

Functions

Link copied to clipboard
open fun create(): Pipeline

Creates an instance of this pipeline via reflection using a no argument constructor, used during copying. Throws an error if this class doesn't have a default constructor. Subclasses can override it to create an instance without using a default constructor.

Link copied to clipboard
fun dependencies(init: Dependencies.() -> Unit)

Configures dependencies

Link copied to clipboard
fun id(id: String)

Sets the relative part of the id to the specified value.

Link copied to clipboard

Configures pipeline integrations.

Link copied to clipboard
fun job(job: Job)
fun job(init: Job.() -> Unit): Job

Adds a job to the pipeline.

Link copied to clipboard
fun outputParams(init: Parametrized.() -> Unit)

Configures pipeline output parameters. Output parameters are exposed to downstream pipelines and build configurations via %dep.PipelineId.paramName% syntax.

Link copied to clipboard

Configures pipeline parameters

Link copied to clipboard

Configures VCS repositories for the pipeline. Allows setting a main repository and adding additional repositories.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun triggers(init: PipelineTriggers.() -> Unit)

Configures pipeline triggers.

Link copied to clipboard
open override fun validate(consumer: ErrorConsumer)

Validates the pipeline configuration. Checks that all required properties are set and all components are valid.