This project demonstrates how to build and test a TeamCity plugin with multiple nodes and how to extend the Gradle TeamCity Environments plugin.
The project contains the following
-
build-logic
a project that implements a Gradle pluginteamcity-multinode-environments
that extends the Gradle TeamCity plugin to add support to run multiple TeamCity nodes. -
multi-node-groovy
a project using the Groovy DSL that provides an example multi-node configuration using the Gradle plugin inbuild-logic
to deploy the TeamCity plugin from theteamcity-plugin
project. -
multi-node-kotlin
a project using the Kotlin DSL that provides an example multi-node configuration using the Gradle plugin inbuild-logic
to deploy the TeamCity plugin from theteamcity-plugin
project. -
teamcity-plugin
a project that implements a simple TeamCity plugin to be deployed to the multi node environment.
The example multi node environments in multi-node-groovy
and multi-node-kotlin
configure an environment using
TeamCity version 2024.03.1 with 2 nodes, node1
on port 8211
and node2
on port 8311
and a database using MySQL.
The example environment can be seen in the following Groovy and
Kotlin build scripts.
The teamcity-multinode-environments
plugin provides the following commands for each environment
-
deployTo<environment>
-
undeployFrom<environment>
-
create<environment>Database
a task to create the MySQL database to be used by the TeamCity nodes -
start<environment>Database
a task to start the MySQL database -
stop<environment>Database
a task to stop the MySQL database -
configure<environment>Database
a task to configure the TeamCity database properties file and deploy the JDBC driver -
start<environment><node>Server
a task to start the TeamCity server node -
stop<environment><node>Server
a task to stop the TeamCity server node -
start<environment>Agent
a task to start the TeamCity Build Agent, the task requires the main server to be started -
stop<environment>Agent
a task to stop the TeamCity Build Agent -
start<environment>
a task to start the MySQL database, TeamCity Server nodes and Build Agent -
stop<environment>
a task to stop the MySQL database, TeamCity Server nodes and Build Agent
The tasks to start and stop an environment are executed in order so that the database is started before the nodes and the build agent after the main node.
After starting the environment both nodes should appear in the Nodes Configuration and the TeamCity plugin in Plugins.