jetbrains.buildServer.configs.kotlin.v10 / Project

Project

open class Project

Represents TeamCity project.

The uuid, extId, and name are mandatory properties for a valid project.

The parentId property defines a place for this project in a project hierarchy, it should be empty for the Root project on the server, and non-empty for other projects.

To appear in UI project should be either registered via the project call in the .teamcity/{ProjectExtId}/settings.kts or added as a subproject to a registered project via the subProject() method.

BuildTypes, templates, and vcsRoots can be registered in the project using the buildType, template, and vcsRoot methods accordingly. BuildTypes and subprojects order can be specified via the buildTypesOrder, buildTypesOrderExtIds, and subProjectsOrder methods.

Project parameters are defined inside the params block.

The cleanup tab in the project admin UI contains clean-up rules for the project itself, its subprojects, and build configurations. In DSL the cleanup block in the project defines the clean-up rules for project itself, subprojects and buildTypes define their clean-up rules.

Other tabs in the project admin UI are either not stored in VCS (e.g. SSH keys), or are defined as project features in the features block.

//A minimal valid project:

val parentExtId = "ParentProjectExtId"
Project({
    uuid = "3dd8b78d-e71c-4065-8ce7-09d6d154c99a"
    parentId = parentExtId
    extId = "Integration Tests".toExtId(parentExtId)
    name = "Integration Tests"
})
//A project with build configurations:

val parentProjectExtId = "ParentProjectExtId"
val projectExtId = "Integration Tests".toExtId(parentProjectExtId)

val linux = BuildType({
    uuid = "fe255589-595a-4c2d-8c3f-6aa616441f9c"
    extId = "Linux".toExtId(projectExtId)
    name = "Linux"
})

val windows = BuildType({
    uuid = "a8678e4d-5621-4ea5-8a3a-c9c46704e990"
    extId = "Windows".toExtId(projectExtId)
    name = "Windows"
})

Project({
    uuid = "3dd8b78d-e71c-4065-8ce7-09d6d154c99a"
    parentId = parentProjectExtId
    extId = projectExtId
    name = "Tests"

    buildType(linux)
    buildType(windows)
})
//A project with subprojects:

val parentExtId = "ParentProjectExtId"
val projectExtId = "Tests".toExtId(parentExtId)

val subProject = Project({
    uuid = "3dd8b78d-e71c-4065-8ce7-09d6d154c99b"
    parentId = projectExtId
    extId = "Slow Tests".toExtId(projectExtId)
    name = "Slow Tests"
})

Project({
    uuid = "3dd8b78d-e71c-4065-8ce7-09d6d154c99a"
    parentId = parentExtId
    extId = projectExtId
    name = "Tests"

    subProject(subProject)

    //add a subproject without defining it as a variable
    subProject {
        uuid = "3dd8b78d-e71c-4065-8ce7-09d6d154c99c"
        parentId = projectExtId
        extId = "Fast Tests".toExtId(projectExtId)
        name = "Fast Tests"
    }
})

See Also

BuildType

Template

VcsRoot

Constructors

<init>

Project(init: Project.() -> Unit = {}, base: Project? = null)

Creates a new project. Copies all settings from the specified base (if it is not null) and runs the init function on the created instance.

Project()

Represents TeamCity project.

Properties

archived

var archived: Boolean

Whether this project is archived

buildTypes

val buildTypes: MutableList<BuildType>

buildTypesOrder

var buildTypesOrder: List<BuildType>?

Specifies buildTypes order

buildTypesOrderExtIds

var buildTypesOrderExtIds: List<String>?

Specifies buildTypes order. Should contain buildType extIds, has precedence over buildTypesOrder: when it is not null, buildTypesOrder is ignored. Can be used when buildTypes are created inline.

cleanup

val cleanup: Cleanup

defaultTemplate

var defaultTemplate: String?

External id of a default template.

description

var description: String

Project description

extId

var extId: String

Project external id. It appears in web UI and is used in urls. Can be changed at any time. But be aware that some settings use it, e.g. as a part of parameter reference. If you change the extId, you should find all its occurrences in the current project and change them too.

features

val features: ProjectFeatures

name

var name: String

Project name

params

val params: ParametrizedWithType

parentId

var parentId: String

External id of the parent project, defines a place for this project in a project hierarchy. Can be omitted for the Root project on the server, otherwise it is mandatory.

roots

val roots: MutableList<VcsRoot>

subProjects

val subProjects: ArrayList<Project>

subProjectsOrder

var subProjectsOrder: List<String>?

Specifies subprojects order, contains subproject extIds.

templates

val templates: MutableList<Template>

uuid

var uuid: String

Project uuid. It is mandatory, TeamCity uses it to identify entities. If project's uuid changes, TeamCity considers it to be a new project.

Functions

buildType

fun buildType(base: BuildType? = null, init: BuildType.() -> Unit = {}): BuildType

Registers a new buildType in this project

cleanup

fun cleanup(base: Cleanup? = null, init: Cleanup.() -> Unit = {}): Unit

Configures project clean-up rules

features

fun features(base: ProjectFeatures? = null, init: ProjectFeatures.() -> Unit = {}): Unit

Allows to specify project features

params

fun params(base: Parametrized? = null, init: ParametrizedWithType.() -> Unit = {}): Unit

Configures project parameters

subProject

fun subProject(base: Project? = null, init: Project.() -> Unit = {}): Project

Adds a subproject to this project

subProjects

fun subProjects(vararg projects: Project): Unit

Sets subprojects of this project

template

fun template(base: Template? = null, init: Template.() -> Unit = {}): Template

Registers a new template in this project

vcsRoot

fun vcsRoot(base: VcsRoot? = null, init: VcsRoot.() -> Unit = {}): VcsRoot

Registers a new VCS root in this project