Pipeline

Deprecated

Pipelines DSL is in development and should not be used. Breaking changes are expected.

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 jetbrains.buildServer.configs.kotlin.Project.pipeline method.

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

Pipeline settings are grouped into blocks:

Example. Pipeline defined as an object with jobs

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

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"

val vcsRoot = GitVcsRoot({
name = "Main Repository"
url = "https://github.com/example/repo.git"
branch = "refs/heads/main"
})

mainVcsRoot = PipelineOwnVcsRoot(vcsRoot)

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()

Types

Link copied to clipboard

Represents a reference to an external VCS root.

Link copied to clipboard

Represents a VCS root defined within the pipeline.

Link copied to clipboard
sealed interface PipelineVcsRoot

Interface for pipeline VCS roots. A pipeline can have either a PipelineOwnVcsRoot or a PipelineExternalVcsRoot.

Properties

Link copied to clipboard

Additional VCS roots for the pipeline.

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

Pipeline jobs

Link copied to clipboard

Main VCS root for the pipeline. This is a required property. Can be set using either PipelineOwnVcsRoot or PipelineExternalVcsRoot.

Link copied to clipboard

Pipeline name

Link copied to clipboard
Link copied to clipboard

Pipeline parameters

Link copied to clipboard

Functions

Link copied to clipboard

Adds an additional VCS root to the pipeline.

Adds a new additional VCS root initialized with the specified block.

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 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(id: String, init: Job.() -> Unit): Job

Adds a job to the pipeline.

Link copied to clipboard

Configures pipeline notifications.

Link copied to clipboard

Configures pipeline parameters

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.