Template

Represents TeamCity build template.

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

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

Template settings are grouped into blocks similar to tabs in the build template admin UI:

See also

Constructors

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

Creates a template 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

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

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

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

Creates an instance of this template 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
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)