Please make sure to read the general information about Artifactory's Build Integration before going into the TeamCity-specific documentation.
Release Management with the TeamCity Artifactory Plugin Version 2.1.0 of the plugin introduces powerful Release Management and Promotion capabilities.
Overview
The TeamCity Artifactory plugin brings CI Build Integration to TeamCity users. This lets you capture information about deployed artifacts, resolved dependencies and environment data associated with TeamCity build runs and have full traceability for your builds.
Build Integration also takes care of deploying your artifacts to Artifactory efficiently.
You can read more about the concept of Build Integration, BuildInfo and how it is used in Artifactory here.
Support for multiple Build Runner types The TeamCity Artifactory plugin supports almost all build runner types, including: Maven2/3, Ivy/Ant (with Ivy modules support), Gradle , NAnt, MSBuild, FxCop and Ipr.
Installing the Plugin
Requirements
Some features of the plugin will only run on the recent versions of Artifactory and TeamCity. To be able to make the most of the plugin the recommended requirements are:
Plugins are deployed to TeamCity by simply placing the packaged plugin into the $TEAMCITY_USER_HOME/.BuildServer/plugins folder and restarting TeamCity (if you have an older version of the plugin, make sure to remove it).
Compatibility Matrix
Artifactory plugin version
TeamCity version
Artifactory version
1.0
5.1
2.2.4
1.0.1
5.1.1
2.2.5+
1.1.1 - 1.1.2
5.1.3
2.3.0+
1.1.3
5.1.5
2.3.0+
2.0.0
6.0+
2.3.0+
2.0.1
6.0+
2.3.0+
2.1.0
6.5+
2.3.4+
2.1.1
6.5+
2.3.4+
2.1.2
6.5.5+
2.3.4+
Configuration
To use the TeamCity Artifactory plugin you will first need to configure your Artifactory server(s) in TeamCity's server configuration. Then you can set up a project build runner to deploy artifacts and Build Info to a repository on one of the configured Artifactory servers.
Configuring System-wide Artifactory Server(s)
To make Artifactory servers globally available to project-runner configurations, they must be defined in Administration->Server Configuration->Artifactory.
Click on "Create new Artifactory server configuration" and fill in the URL of the Artifactory server.
Deployer credentials can be set at the global level for all builds. Deploy credentials can be set or overridden at a project build level.
Resolving repository Username and password are optional and only used when querying Artifactory's REST API for a list of configured repositories (credentials are only required if the target instance does not allow anonymous access).
Configuring Project-specific Runners
Editing Project-specific Configuration
To set up a project runner to deploy build info and artifacts to Artifactory go to Administration->$PROJECT_NAME->$BUILD_NAME->Edit->Runner (Step 3)->Deploy artifacts to Artifactory.
Upon selecting an Artifactory server URL, the server will be queried for a list of configured repositories (using the credentials in the server configuration, if configured). This will populate the "Target Repository" combobox with a list of target repositories to deploy too.
If the repository list remains empty, make sure the specified Artifactory server URL, credentials and proxy information (if provided) are valid.
Any information about communication errors which might occur can be found in the TeamCity server logs.
The 'Deploy maven artifacts' option will only be avialable when using a 'Maven2' build runner.
Running License Checks
You use the Artifactory Pro Licene Control feature to discover and handle third party dependency licensing issues as part of the build.
Check the 'Run license checks' option if wish that Artifactory will scan and check the licenses of all dependencies used by this build. If you wish to inform selected users about any license violations detected while scanning, you may enter a white-spaced list of e-mail addresses to the notification recipients text box.
Advanced Options
In addition, you have more advanced options:
The 'Published artifacts' area lets you specify which artifact files produced by the build will be published to Artifactory. At the end of the build the plugin will locate artifacts in the build's checkout directory according to the specified artifact patterns and will publish them to Artifactory, optionally applying mapping for the target path of each deployed artifact. The pattern and mapping syntax for Published Artifacts is similar to the one used by TeamCity for Build Artifacts.
The 'Downloaded artifacts' area lets you specify dependency patterns for published artifacts that should be downloaded from Artifactory before the build is run. You can have fine control over which artifacts will be resolved and downloaded by using query-based resolution, adding to your artifact paths a query with the properties that the artifact should have before it can be downloaded. Read more about resolution by properties.
Attaching Searchable Parameters to Build-Info and to Published Artifacts
Under Administration->$PROJECT_NAME->$BUILD_NAME->Edit->Runner (Step 6)->Properties and Environment Variables, it is possible to define parameters that will be attached to the build-info and produced artifacts.
To define a parameter click on the "Add new property" or "Add new variable" buttons (both system properties and environment variables are supported).
Available parameter types:
buildInfo.property.* - All properties starting with this prefix will be added to the root properties of the build-info.
artifactory.deploy.* - All properties starting with this prefix will be attached to any deployed produced artifacts.
It is also possible to point the plugin to a properties file containing the aforementioned properties.
To point to such a file, define a property by the name buildInfoConfig.propertiesFile and set its value to the absolute path of the properties file.
Please note that the given path and file should be present in the machine that is running the build agent, not the server.
Viewing Project-specific Configuration
Existing project configuration can be viewed from Projects->$PROJECT_NAME->$BUILD_NAME->Settings->Runner settings:
Running a Build with the Artifactory Plugin
Once you have completed setting up a project runner you can run a project build. The Artifactory plugin will kick in at the end of the build and will:
For all build runner types - publish the specified Published Artifacts to the selected target repository and apply proper path mappings.
For Maven or Ivy/Ant build runner - Deploy all artifacts to the selected target repository in one go (as opposed to the deploy at the end of each module build, used by Maven and Ivy).
You can also link directly to the information in Artifactory from a build run view:
Triggering Builds in Reaction to Changes in Artifactory
The plugin allows you to set a new type of trigger that will periodically poll a path in Artifactory, a folder or an individual file. Whenever a change is detected to this path, for example new artifacts have been deployed, the TeamCity build will be triggered. This feature can only be used with the Artifactory Pro Power Pack.
To configure a new build trigger, first select the Artifactory Build Trigger from Administration->$PROJECT_NAME->$BUILD_NAME->Edit->Build Triggering:
Select the server, repository and paths in the repository for which you would like to automatically trigger a build upon change in the item content.
Fill-in a username and a password of a valid deployer (note that the user has to have deploy rights on any local repository).
Narrow down the scope for scanning When scanning a remote folder for changes, Artifactory has to traverse the folder content and figure out if any content has changed. For deep folders this traversal can become quite expensive. Therefore it is recommended to keep the scanning scope to the minimum possible.
Proxy Configuration
Currently, TeamCity does not provide a global point of proxy configuration; so in a case where the target Artifactory server needs to be accessed via a proxy, proxy configuration can be achieved by setting the following properties inside the $TEAMCITY_USER_HOME/.BuildServer/config/internal.properties file.
License
The TeamCity Artifactory plugin is available under the Apache v2 License.
Watch the Screencast
To see the Teamcity plugin in action you can watch the short demo screencast below.
1 Comment
comments.show.hideNov 10, 2011
p ido
I've installed 'teamcity-artifactory-plugin-2.0.1' i see all plugin UI section described in this page except The 'Published artifacts'.
Where should i find the advanced options? (i'm using maven runner and i see the 'Deploy artifacts to artifactory').
Thanks