VcsRoot
A base class representing TeamCity VCS root.
To appear in UI a VCS root should be registered in a project using the vcsRoot method.
VCS root can be attached to a build configuration or template with specified checkout rules using the root() method in the vcs() block.
The id, name, and type are mandatory properties for a valid VCS root (id can be omitted if it matches the class name).
VCS root parameters can be defined via the param method. TeamCity vcs plugins extend this class and provide a typed DSL which makes editing parameters easier.
Example. Add Git VCS Root.
project {
// ...
vcsRoot(MyVcsRoot)
buildType{
id = "MyBuild"
name = "MyBuild"
vcs {
root(MyVcsRoot)
}
// ...
}
}
object MyVcsRoot: GitVcsRoot({
name = "My project main repository"
url = "<repository URL>"
branch = "refs/heads/main"
checkoutPolicy = AgentCheckoutPolicy.USE_MIRRORS
authMethod = uploadedKey {
uploadedKey = "<SSH key name>"
}
})
See also
Constructors
Functions
Copies parameters of this object to the specified target
Creates an instance of this VCS root 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.
Sets the id to the specified value. Type of the id depends on the context in which DSL is executed: it is RelativeId when DSL context is relative, otherwise it is AbsoluteId.
Validates this object and reports found errors to the provided consumer
Properties
VCS root id. It appears in the web UI and is used in urls. If the VCS root has a uuid specified, then the id can be changed at any time. If uuid is omitted, then TeamCity treats a VCS root with a changed id as a new VCS root, all data associated with the old root will be lost (e.g. a commits graph). 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 VCS roots 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).
Helper for creating references to parameters of this VCS root