jetbrains.buildServer.configs.kotlin.v2017_2 / Project

Project

open class Project : Validatable

Represents TeamCity project.

The uuid, id, 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/{Project id}/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 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 the project itself, subprojects and buildTypes can define their own clean-up rules or inherit them from the parent project(default).

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 parentProjectId = "ParentProjectId"
Project({
    uuid = "3dd8b78d-e71c-4065-8ce7-09d6d154c99a"
    parentId = parentProjectId
    id = "Integration Tests".toId(parentProjectId)
    name = "Integration Tests"
})
//A project with build configurations:

val parentProjectId = "ParentProjectId"
val projectId = "Integration Tests".toId(parentProjectId)

val linux = BuildType().apply {
    uuid = "fe255589-595a-4c2d-8c3f-6aa616441f9c"
    id = "Linux".toId(projectId)
    name = "Linux"
}

val windows = BuildType().apply {
    uuid = "a8678e4d-5621-4ea5-8a3a-c9c46704e990"
    id = "Windows".toId(projectId)
    name = "Windows"
}

Project({
    uuid = "3dd8b78d-e71c-4065-8ce7-09d6d154c99a"
    parentId = parentProjectId
    id = projectId
    name = "Tests"

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

val parentProjectId = "ParentProjectId"
val projectId = "Tests".toId(parentProjectId)

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

Project({
    uuid = "3dd8b78d-e71c-4065-8ce7-09d6d154c99a"
    parentId = parentProjectId
    id = projectId
    name = "Tests"

    subProject(subProject)

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

See Also

BuildType

Template

VcsRoot

Constructors

<init>

Project(init: Project.() -> Unit)

Creates a project and initializes it with the specified init block

Project()

Represents TeamCity project.

Properties

archived

var archived: Boolean

Whether this project is archived

buildTypesOrder

var buildTypesOrder: List<BuildType>

Specifies buildTypes order

buildTypesOrderExtIds

var buildTypesOrderExtIds: List<String>

Specifies buildTypes order. Contains buildType ids. Can be also be filled by buildTypesOrder property

buildTypesOrderIds

var buildTypesOrderIds: List<String>

Specifies buildTypes order. Contains buildType ids. Can be also be filled by buildTypesOrder property

defaultTemplate

var defaultTemplate: String?

Id of default template. Null (by default) means no default template.

description

var description: String

Project description

extId

var extId: String

Project 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 a parameter reference. If you change the id, you should find all its occurrences in the current project and change them too.

id

var id: String

Project 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 a parameter reference. If you change the id, you should find all its occurrences in the current project and change them too.

name

var name: String

Project name

parentId

var parentId: String

Id of the parent project, defines a place for this project in a project hierarchy. Can be omitted if the parent project is the Root project or project is added to parent using subProject method. Otherwise it is mandatory.

subProjectsOrder

var subProjectsOrder: List<String>

Specifies subprojects order, contains subproject ids.

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(bt: BuildType): Unit

Registers the specified buildType in this project

fun buildType(init: BuildType.() -> Unit): BuildType

Registers a new buildType initialized with the specified block in this project

cleanup

fun cleanup(init: Cleanup.() -> Unit): Unit

Configures project clean-up rules

create

open fun create(): Project

Creates an instance of this project 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.

features

fun features(init: ProjectFeatures.() -> Unit): Unit

Allows to specify project features

params

fun params(init: ParametrizedWithType.() -> Unit): Unit

Configures project parameters

subProject

fun subProject(init: Project.() -> Unit): Project

Adds a subproject to this project

fun subProject(subProject: Project): Unit

Adds the specified subproject to this project

subProjects

fun subProjects(vararg projects: Project): Unit

Sets subprojects of this project

template

fun template(template: Template): Unit

Registers the specified template in this project

fun template(init: Template.() -> Unit): Template

Registers a new template initialized with the specified init block in this project

toString

open fun toString(): String

validate

open fun validate(consumer: ErrorConsumer): Unit

Validates this object and reports found errors to the provided consumer

vcsRoot

fun vcsRoot(root: VcsRoot): Unit

Registers the specified VCS root in this project

fun vcsRoot(init: VcsRoot.() -> Unit): VcsRoot

Registers a new VCS root initialized with specified init build in this project