TeamCity

4 minute readExtensibilityDeveloper productivity

Use the EC-TeamCity plugin to interact with the TeamCity server to do tasks such as managing agents, pools, and running builds.

Plugin Version 2.0.2.2020102201 Revised on Aug 26, 2020

Supported versions:

This plugin was developed and tested with TeamCity 10.

Setting up the plugin configuration

Plugin configurations are sets of parameters that apply across some or all of the plugin procedures. They reduce repetition of common values, create predefined sets of parameters for end users, and store credentials securely. Each configuration has a unique name that is automatically entered in designated parameters in the procedures.

Input

  1. Go to Administration Plugins to open the plugin manager.

  2. Find the EC-TeamCity row.

  3. Click Configure to open the TeamCity Configurations page.

  4. Click Create Configuration.

  5. To enable CloudBees CD to communicate with your TeamCity server, enter the following information. Provide a unique name for the configuration, keeping in mind that you may need to create additional configurations over time.

ParameterDescription

Configuration Name

Provide a unique name for the connection.

Hostname

Hostname of the TeamCity server

Port

Port which used by the TeamCity server

Protocol

Protocol which used by the TeamCity server.

Login As

Supply TeamCity account username/password. Use "guest" username and an empty password for guest access.

Output

The TeamCity Configurations page now shows the new configuration.

Plugin procedures

Get agents

Get a list of agents

Input

  • Go to the "Get Agents" procedure.

  • Enter the following parameters:

ParameterDescription

Configuration name

The name of the saved configuration for accessing the TeamCity server

Output

After the job runs, you can view the results.

In the Get Agents step, click the Log icon to see the diagnostic information.

Enable agent

Enable or disable the agent.

Input

  • Go to the "Enable Agent" procedure.

  • Enter the following parameters:

ParameterDescription

Configuration Name

The name of the saved configuration for accessing the TeamCity server

Agent ID

Agent identifier for setting the enabled state

Enable

The enabled state for the agent

Comment

Optional comment on agent status change

Output

After the job runs, you can view the results, including the following job details, which show that the job was completed.

In the Enable Agent step, click the Log icon to see the diagnostic information.

Authorize agent

Set the authorization status for the agent.

Input

  • Go to the "Authorize Agent" procedure.

  • Enter the following parameters:

ParameterDescription

Configuration Name

The name of the saved configuration for accessing the TeamCity server

Agent ID

Agent identifier for setting the authorization state

Authorize

The authorized status for the agent

Output

After the job runs, you can view the results.

In the Authorize Agent step, click the Log icon to see the diagnostic information.

Assign agent to pool

Assign agent to the pool.

Input

  • Go to the Assign Agent to Pool procedure.

  • Enter the following parameters:

ParameterDescription

Configuration Name

The name of the saved configuration for accessing the TeamCity server

Agent ID

Identifier of the agent to be assigned to the pool

Pool ID

Pool identifier for agent assignment

Output

After the job runs, you can view the results.

In the Assign Agent to Pool step, click the Log icon to see the diagnostic information.

Get pools

Get a list of agent pools

Input

  • Go to the "Get Pools" procedure.

  • Enter the following parameters:

ParameterDescription

Configuration name

The name of the saved configuration for accessing the TeamCity server

Output

After the job runs, you can view the results. In the Get Pools step, click the Log icon to see the diagnostic information.

Get build types

Get the list of build configurations

Input

  • Go to the "Get Build Types" procedure.

  • Enter the following parameters:

ParameterDescription

Configuration name

The name of the saved configuration for accessing the TeamCity server

Output

After the job runs, you can view the results. In the Get Build Types step, click the Log icon to see the diagnostic information.

Build

Run the build task

Input

  • Go to the "Build" procedure.

  • Enter the following parameters:

ParameterDescription

Configuration Name

The name of the saved configuration for accessing the TeamCity server

TeamCity Build ID

The build task identifier to be launched

Parameters

The additional parameters for the build. Each parameter must be on a new line in the format "key=value".

Property for resulting internal build ID

Property name used to store the resulting internal building identifier

Output

After the job runs, you can view the results. In the Build step, click the Log icon to see the diagnostic information.

Import build artifact

Import build artifact from TeamCity to the CloudBees CD repository

Input

  • Go to the "Import Build Artifact" procedure.

  • Enter the following parameters:

ParameterDescription

Configuration Name

The name of the saved configuration for accessing the TeamCity server

Internal Build ID

The internal building identifier of successfully completed build

Repository Name

The name of the repository into which the artifact will be published

Artifact Group

The group of the published artifact

Artifact Key

The key of the published artifact

Artifact Version

The version of the published artifact

Output

After the job runs, you can view the results. In the Import Artifact step, click the Log icon to see the diagnostic information. The output is similar to the following diagnostic report:

Get build log

Get a log of the completed build

Input

  • Go to the "Get Build Log" procedure.

  • Enter the following parameters:

ParameterDescription

Configuration name

The name of the saved configuration for accessing the TeamCity server

Internal build ID

The internal building identifier of which the log will be received

Output

After the job runs, you can view the results. In the Get Log step, click the Log icon to see detailed log of the complited build. The output is similar to the following report:

Release notes

EC-TeamCity 2.0.2

  • The documentation has been migrated to the main documentation site.

EC-TeamCity 2.0.1

  • Added support for the CSRF protection.

  • Procedure "Build" saves additional build properties: buildUrl, buildStatus, buildState.

  • Upgraded plugin configuration management.

EC-TeamCity 2.0.0

  • The plugin icon has been updated.

EC-TeamCity 1.2.10

  • Added the ability to specify additional parameters for the build

EC-TeamCity 1.2.9

  • Added the possibility of guest access to the TeamCity server

  • Added protocol selection for access to the TeamCity server (HTTP/HTTPS)

EC-TeamCity 1.2.8

  • Fixed an error in the name of the procedure parameters

  • Added procedure "Get Build Log"

  • The procedure "Build" returns the build identifier regardless of the status of the completed task

EC-TeamCity 1.2.7

  • Fixed the procedure definition in pipeline interface

  • Added default settings for procedures "Build" and "Import Build Artifact"

  • Corrected labels for the parameters of procedures

EC-TeamCity 1.2.6

  • Added procedure "Import Build Artifact"

  • Procedure "Build" stores the internal build identifier to job property

EC-TeamCity 1.2.5

  • Added plugin help

EC-TeamCity 1.2.4

  • Fixed typo in the "Build" procedure

  • Did minor code refactoring

EC-TeamCity 1.2.3

  • Did minor fixes

EC-TeamCity 1.2.2

  • Changed the procedure names in the step picker section

EC-TeamCity 1.2.1

  • Upgraded the plugin to use the new XML parameter form

EC-TeamCity 1.2.0

  • Added procedure "Build"

  • Added procedure "Get Build Types"

EC-TeamCity 1.1.0

  • Added procedure "Get Agents"

  • Added procedure "Get Pools"

EC-TeamCity 1.0.0

  • Initial version