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

Usage

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

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

{bgcolor:yellow} *Starting from 8.1*, these properties should be replaced with {{teamcity.build.triggeredBy}} /{{teamcity.build.triggeredBy.username}} {bgcolor}

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

Development links

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 2017.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

{hidden-data}
Obsolete
h2. History

|| Date || Changes ||
| June, 9, 2011 | Updated plugin for compatibility with TeamCity 6.5 |
| January, 25, 2010 | Fix [TW-10816|http://youtrack.jetbrains.net/issue/TW-10816] |
| October, 16, 2009 | rename {{env.BUILD_VCS_LASTCHANGE_TIMESTAMP}} into {{env.BUILD_VCS_LASTINCLUDED_TIMESTAMP}} \\
rename system.build.lastChange.time into system.build.vcs.lastIncluded.timestamp}} \\
remove {{build.vcs.lastIncluded.revision}} configuration property (use {{system.build.vcs.lastIncluded.revision}} instead) \\
fix typo in {{build.vcs.lastIncluded.revision}} system property name (was {{build.vcs.lastIncluided.revision}}) \\
If you modified the default scripts before, please note that they are renamed too: \\
{{GroovyReferencePropertiesProvider}} renamed into {{GroovyPropertiesProvider}} \\
{{GroovyPropertyProvider}} renamed to {{GroovyParametersPreprocessor}} (and is empty by default) \\
If you do not want to upgrade, use latest [build|http://teamcity.jetbrains.com/viewLog.html?buildId=26175&tab=artifacts&buildTypeId=bt151] without these changes |
| October, 12, 2009 | Make compatible with TeamCity 5.0 EAP. The plugin is no longer compatible with TeamCity 4.5.x and below |
| August, 19, 2009 | Fixed bug that caused multiple NullPointerException's in TeamCity 5.0 builds |
| June, 19, 2009 | Added {{build.vcs.lastIncluded.revision}} reference property |
| April, 15, 2009 | added {{build.triggeredBy}} and {{build.triggeredBy.username}} reference properties |
| April, 11, 2009 | rename reference property {{system.build.start.date}} into {{build.start.date}} and {{system.build.start.time}} into {{build.start.time}}, add empty BuildServerListener |
| April, 2, 2009 | Added {{build.vcs.lastIncluded.revision}} properties to use in a build. |
| March, 31, 2009 | Initial checkin |
{hidden-data}