teamcity-build-scan-plugin
The work on this software project is in no way associated with my employer nor with the role I'm having at my employer. Any requests for changes will be decided upon exclusively by myself based on my personal preferences. I maintain this project as much or as little as my spare time permits.
Overview
TeamCity plugin that integrates with build scans for Gradle and Maven. Build scans are available as a free service on scans.gradle.com and commercially via Gradle Enterprise.
For each Gradle and Maven build that is run from TeamCity, this plugin exposes the links to the created build scans in the TeamCity UI.
The plugin is available from the JetBrains Plugins Repository.
Build scan
Recent build scan: https://gradle.com/s/yevfzaz2bvvh4
Find out more about build scans for Gradle and Maven at https://scans.gradle.com.
Version compatibility
<=0.22
These plugin versions require that you use at least Gradle Enterprise Gradle plugin 3.0 or Gradle Build Scan plugin 1.8 in your Gradle builds, or Gradle Enterprise Maven extension 1.0 in your Maven builds.
>=0.23
These plugin versions require that you use at least Gradle Enterprise Gradle plugin 3.0 or Gradle Build Scan plugin 1.8 in your Gradle builds, or Gradle Enterprise Maven extension 1.11 in your Maven builds.
It is recommended that you use the latest Gradle Enterprise Gradle plugin version or latest Gradle Build Scan plugin version and the latest Gradle Enterprise Maven extension version at all times to get the most insights from your builds.
TeamCity build runner requirements
Gradle builds
If you use TeamCity's GradleRunner to launch your Gradle builds, there is nothing special to do.
If, and only if, you do not use TeamCity's GradleRunner to launch Gradle builds, apply the TeamCity build scan Gradle plugin to your Gradle builds in order to notify TeamCity about the build scans that were published while running a build.
If you do not use TeamCity's GradleRunner to launch Gradle builds and you do not apply the TeamCity build scan Gradle plugin to your Gradle builds, you can still get integration with build scans, but it requires your build logs being parsed for build scan links. In case of huge build logs, this can put a significant toll on the performance of your TeamCity instance. You can enable the parsing of the build logs by creating a TeamCity configuration parameter with name BUILD_SCAN_LOG_PARSING
and setting the value to true
.
Maven builds
If you use TeamCity's MavenRunner to launch Maven builds, there is nothing special to do.
If you do not use TeamCity's MavenRunner to launch Maven builds, you can still get integration with build scans, but it requires your build logs being parsed for build scan links. In case of huge build logs, this can put a significant toll on the performance of your TeamCity instance. You can enable the parsing of the build logs by creating a TeamCity configuration parameter with name BUILD_SCAN_LOG_PARSING
and setting the value to true
.
Installation
Option 1: Conveniently select plugin
- Go to the plugin list of your TeamCity installation at
<TeamCityInstanceRootUrl>/admin/admin.html?item=plugins
and browse the plugins repository. - Select, install, and activate the plugin as described here.
Option 2: Manually upload plugin
-
Download the plugin
.zip
file from https://plugins.jetbrains.com/plugin/9326-integration-for-gradle-and-maven-build-scans. -
Go to the plugin list of your TeamCity installation at
<TeamCityInstanceRootUrl>/admin/admin.html?item=plugins
and click on the link Upload plugin zip to install the previously downloaded plugin.zip
file. -
Restart TeamCity.
-
Trigger your Gradle builds with build scans enabled.
-
Find the links of the published build scans in the Overview section of each TeamCity build.
Automatic Gradle Enterprise Plugin Setup
-
In TeamCity, on the build configuration for which you want to apply Gradle Enterprise, create 3 configuration parameters:
GRADLE_ENTERPRISE_URL
- the URL of the Gradle Enterprise instance to which you want to publish build scans.GRADLE_ENTERPRISE_PLUGIN_VERSION
- the version of the Gradle Enterprise plugin to apply to the build.CCUD_PLUGIN_VERSION
- the version of the Common Custom User Data plugin to apply to the build.
-
Trigger your Gradle build.
-
Find the links of the published build scans in the Overview section of each TeamCity build.
Slack Integration
-
In Slack, create a webhook and keep track of the created URL.
-
In TeamCity, on the build configuration for which you want to be notified about published build scans, create a configuration parameter with name
BUILD_SCAN_SLACK_WEBHOOK_URL
and the value being the URL of the webhook created in step #1. -
Trigger your Gradle builds with build scans enabled.
-
Find a notification about the published build scans in the Slack channel configured in the webhook.
Feedback and Contributions
Both feedback and contributions are very welcome.
Acknowledgements
- madlexa (pr #47 that adds TeamCity 2022.04 compatibility)
- facewindu (pr #21 that includes init script test coverage)
- dmitry-treskunov (bug report and proposed fix)
- pbielicki (pr #17 that adds a hint to the BuildScanServiceMessageMavenExtension @Component)
- jonnybbb (pr #14 and #15 that store build scan links under artifacts and clean up legacy data)
- davidburstromspotify (bug report and proposed fix)
- guylabs (pr #10 that provides support for the Gradle Enterprise Gradle plugin)
- autonomousapps (pr #9 that provides build scans for Maven builds)
- mark-vieira (pr #6 that provides message service functionality)
- pavelsher (several code pointers)
License
This plugin is available under the Apache License, Version 2.0.
(c) by Etienne Studer