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:
job() - defines a job within the pipeline
repositories() - configures VCS repositories for the pipeline
triggers() - configures pipeline triggers
integrations() - configures pipeline integrations
params() - configures pipeline parameters
outputParams() - exposes output parameters to downstream pipelines and build configurations
Example. Pipeline defined as an object with jobs
The build job shares its output with the test and deploy jobs, which depend on it.
object DeployPipeline: Pipeline({
id("DeployPipeline")
name = "Deploy Pipeline"
repositories {
repository(DslContext.settingsRoot)
}
job {
id("build")
name = "Build Application"
steps {
gradle {
tasks = "clean build"
}
}
outputFiles {
// share the produced jars with downstream jobs and publish reports as pipeline artifacts
sharedWithJobs("build/libs/**/*.jar")
pipelineArtifacts("build/reports/**/*")
}
}
job {
id("test")
name = "Run Tests"
steps {
gradle {
tasks = "test"
}
}
dependency("build")
}
job {
id("deploy")
name = "Deploy Application"
steps {
script {
scriptContent = "./deploy.sh"
}
}
dependency("test")
}
})Example. Pipeline with VCS root and triggers
pipeline {
id("CIPipeline")
name = "CI Pipeline"
repositories {
repository(DslContext.settingsRoot)
}
triggers {
vcs {
branchFilter = "+:*"
}
}
job {
id("build")
name = "Build"
steps {
gradle {
tasks = "clean build"
}
}
}
}See also
Constructors
Properties
Pipeline jobs
Pipeline output parameters exposed to downstream pipelines and build configurations.
Pipeline parameters
Pipeline repositories
Functions
Configures dependencies
Configures pipeline integrations.
Configures pipeline output parameters. Output parameters are exposed to downstream pipelines and build configurations via %dep.PipelineId.paramName% syntax.
Configures pipeline parameters
Configures VCS repositories for the pipeline. Allows setting a main repository and adding additional repositories.
Configures pipeline triggers.
Validates the pipeline configuration. Checks that all required properties are set and all components are valid.