Child pages
  • Groovy plug
Skip to end of metadata
Go to start of metadata

General Info

Vendor

JetBrains

License

Apache 2.0

Type

free, open-source

Plugin Description

Implements several TeamCity extension points with Groovy code. The code can be changed at run-time (by modifying a file under <TeamCity data directory> on the disk). Provides several useful properties out-of-the-box.

Please note that plugin is meant for demonstration purposes and if you plan to use it on a large active TeamCity installation, you should consider implementing the functionality you need in a plain Java plugin.

Installation

  • Prior to TeamCity 10.1, put libraries found under the application_libs directory (available via the download link below) into the WEB-INF/lib directory of TeamCity web application. (This step must also be repeated if you reinstall/upgrade TeamCity)
    (warning) Since 10.1, this step is not required as groovy libraries are packed into the plugin zip.
  • put the plugin groovyPlug.zip into <TeamCity data directory>/plugins
  • restart the server
  • if you edited the scripts earlier and need to use the newly introduced features, rename <TeamCity data directory>/config/_groovyPlug_/*.dist files dropping the .dist suffix.
  • It is recommended to ensure you have at least 150m set to -XX:MaxPermSize JVM option.

Usage

Edit the files in <TeamCity data directory>/config/_groovyPlug_. The changes take effect immediately, no server restart is needed.

Icon

This section describes the current state of the plugin. Earlier versions might have differences in property sets and naming. Also, no guarantees are made as to future plugin versions: the property set can change and properties may be renamed.

The plugin implements the following extension points:

Extension point

Implementation description

ParametersPreprocessor

empty demo extension

BuildParametersProvider

Provides build properties:
system.build.start.date / env.BUILD_START_DATE
system.build.start.time / env.BUILD_START_TIME
system.build.vcs.lastIncluded.revision.<simplified VCS root name> / env.BUILD_VCS_LASTINCLUDED_REVISION_<simplified VCS root name in uppercase> - the revision of the last change of the noted VCS root included into the build. If there is only single VCS root, .<simplified VCS root name> may be omitted.
system.build.vcs.lastIncluded.timestamp.<simplified VCS root name> / env.BUILD_VCS_LASTINCLUDED_TIMESTAMP_<simplified VCS root name in uppercase> - the timestamp of the last change of the noted VCS root included into the build. If there is only single VCS root, .<simplified VCS root name> may be omitted.
build.triggeredBy / build.triggeredBy.username

Starting from 8.1, these properties should be replaced with teamcity.build.triggeredBy /teamcity.build.triggeredBy.username

runParam.<name of run parameter> - Beware: this exposes build configuration settings to a user that can run the build (via custom build)

StartBuildPrecondition

To use the feature, add system.locks.readLock.<lockName> or system.locks.writeLock.<lockName> property to the build configuration.
The build with writeLock will only start when there are no builds running with read or write locks of the same name.
The build with readLock will only start when there are no builds running with write lock of the same name.

BuildServerListener

Empty implementation. Allows to perform actions on various build and server events.

TemplateProcessor

since TeamCity 5.1 Sample implementation. Allows to add objects to model used within notification templates.

TeamCity Versions Compatibility

The trunk plugin version should work with the latest TeamCity public build (EAP or release).
There are also branch builds compatible with TeamCity 4.5.x, 5.0.x, 5.1.x, 6.0.x and 6.5.x. See the #Download section.

Since version 8.0, the shared resources functionality is implemented as a separate plugin
Since version 8.1, the information about the user who triggered the build is reported by the TeamCity core. Issue: TW-4502, parameters description

See Download section for CI builds.
Sources (sources corresponding to the latest TeamCity EAP can be found under trunk.

Download

From CI server:
trunk compatible with TeamCity 10.1+
branch compatible with TeamCity 7.x - 10.0
branch compatible with TeamCity 6.5.x
branch compatible with TeamCity 6.0.x
branch compatible with TeamCity 5.0.x
branch compatible with TeamCity 4.x

Related Materials

Issues:
TW-1643
TW-3798
TW-4502
TW-4080
TW-4527
TW-6619
TW-6784

  • No labels