BuildType

Represents TeamCity build configuration.

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

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

BuildType settings are grouped into blocks similar to tabs in the build configuration admin UI:

Example. Build configuration with a VCS root, VCS trigger and a single Gradle build step

object RunTests: BuildType({
id("RunTests")
name = "Run unit tests"
description = "Runs all unit tests of the project"

vcs {
root(MyProjectVCSRoot)
}

steps {
gradle {
tasks = "clean build"
buildFile = "build.gradle"
}
}

triggers {
vcs {}
}
})

Example. Build configuration defined in-place

object Main: Project({
name = "Main"
description = "The project main branch"

buildType {
id("Build")
name = "Build"

steps {
gradle {
tasks = "clean build"
}
}
}
})

Example. Composite build configuration

object Aggregate: BuildType({
type = BuildTypeSettings.Type.COMPOSITE

vcs {
showDependenciesChanges = true
}

dependencies {
snapshot(BuildPackage) { }
}
}

See also

Constructors

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

Creates a buildType and initializes it with the specified init block

constructor()

Properties

Link copied to clipboard

If true, viewing of the configuration status is allowed externally. False by default.

Link copied to clipboard

Artifact publishing rules. Empty by default, i.e. no artifacts will be published by the build.

Link copied to clipboard

Build number pattern. By default "%build.counter%"

Link copied to clipboard

Helper for creating references to dependency parameters of this buildType.

Link copied to clipboard

Description of a template or build configuration

Link copied to clipboard

Enables hanging builds detection. By default true.

Link copied to clipboard

Controls whether personal builds can be triggered in this build configuration. True by default.

Link copied to clipboard

Checksum of settings that can be set in the build configurations generated by some plugin or REST API script

Link copied to clipboard
open override var id: Id?

BuildType or template id. It appears in the web UI and is used in urls. If the entity has a uuid specified, then the id can be changed at any time. If uuid is omitted, then TeamCity treats an entity with a changed id as a new entity, all data associated with the old entity will be lost (e.g. a build history). Id can also be used by some settings, e.g. as a part of parameter reference. If you change the id, you should find all its occurrences in the current project and change them too. Id must be unique across all buildTypes and templates on the server. If id is missing, it will be generated from the class name (if the class is not from the jetbrains.buildServer.configs.kotlin package).

Link copied to clipboard

Allows to set maximum number of simultaneously running builds. Default value is 0 - means there is no limit on a number of running builds. See also maxRunningBuildsPerBranch.

Link copied to clipboard

Allows to set maximum number of simultaneously running builds per branch. Each line must be in form of branch:number, where branch is either a logical branch name or a pattern containing and number specifies the maximum number of builds which can be simultaneously running in each branch matching the pattern. 0 means there is no limit.

Link copied to clipboard

Build configuration or template name. It must be unique across build configurations or templates in the same project.

Link copied to clipboard

Whether the buildType is paused

Link copied to clipboard

Defines for which builds artifacts should be published. By default, the artifacts are published for successful and failed builds, but are not published for the cancelled and failed to start builds.

Link copied to clipboard
Link copied to clipboard

Ids of the templates this buildType is based on

Link copied to clipboard

Type of this build configuration, when not specified treated as Type.REGULAR

Link copied to clipboard

Build configuration or template uuid. If specified, TeamCity uses this uuid to identify the entity. If uuid is not specified, then id is used instead.

Functions

Link copied to clipboard
fun cleanup(init: Cleanup.() -> Unit)

Configures build clean-up rules

Link copied to clipboard
open fun create(): BuildType

Creates an instance of this buildType 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 disableSettings(vararg ids: String)

Disables settings with the specified ids in this buildType

Link copied to clipboard
Link copied to clipboard
fun features(init: BuildFeatures.() -> Unit)

Configures build features

Link copied to clipboard
fun id(id: String)

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

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

Sets option with specified name and value

Link copied to clipboard

Configures build parameters

Link copied to clipboard
Link copied to clipboard
fun steps(init: BuildSteps.() -> Unit)

Configures build steps

Link copied to clipboard
fun templates(vararg ids: Id)
fun templates(vararg ts: Template)

Specifies a number of templates this buildType is based on

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

Configures build triggers

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

Validates this object and reports found errors to the provided consumer

Link copied to clipboard
fun vcs(init: VcsSettings.() -> Unit)