Example TeamCity Kotlin DSL configuration to build the Gradle TeamCity plugin
There are versioned settings for multiple different setups, each is on a different branch, below is the branch name and a description of the configuration.
-
master
- contains the latest project configuration with build configurations to build the plugin. -
basic
- contains a project configuration with a single build configuration that builds and runs the unit tests with Java 7 -
builds
- contains a project configuration with a number of build configurations that build and run either unit tests or functional tests or sample tests. There is also a code quality build configuration that runs thesonarqube
task. The common build configuration used by all the build configurations is defined using a base build type. -
template
- contains a project configuration with the same build configurations as thebuilds
branch but they are based on a build template.
Follow the steps below to import the settings into a TeamCity Server
-
Create a VCS Root for the TeamCity settings project in the 'Root project'
-
Enter the project URL, https://github.com/rodm/teamcity-settings, in the Fetch URL field
-
Enter the branch, refs/heads/branch, in the Default branch field, where branch is either
basic
,builds
,template
ormaster
.
-
-
Create a new sub-project under the Root project
-
Enter a project name
-
Enter the project ID 'GradleTeamCityPlugin'
-
-
Select 'Versioned Settings'
-
Select the option 'Synchronization enabled', select the VCS root created above then select 'use settings from VCS' and set the format to 'Kotlin' and click the Apply button.
-
A dialog should appear indicating existing settings have been detected, select the 'Import from VCS option'. TeamCity should update the project and create a build configuration.
-
To make changes fork the project and update the VCS root URLs to use your own repository.
Resources
Configuration as Code series by Anton Arhipov in 2019 from the TeamCity blog
Kotlin Configuration Scripts series by Hadi Hariri in 2016 & 2017 from the TeamCity blog