Back to Dagger

TeamCity

docs/current_docs/getting-started/ci-integrations/teamcity.mdx

0.20.72.0 KB
Original Source

TeamCity

TeamCity provides a Dagger Recipe that can be used in any build configuration to call one or more Dagger Functions. The recipe is taken from the JetBrains Marketplace.

How it works

When running a CI pipeline with Dagger using TeamCity, the general workflow looks like this:

  1. A new build is triggered.
  2. The build is sent to an available TeamCity agent.
  3. The Dagger Recipe installs the required version of Dagger CLI on the agent.
  4. The Dagger CLI attempts to find an existing Dagger Engine or spins up a new one.
  5. The Dagger CLI executes the specified command and sends telemetry to Dagger Cloud if the DAGGER_CLOUD_TOKEN environment variable is set.
  6. The build completes successfully or fails. Logs appear in TeamCity as usual.

Prerequisites

Running the examples shown below requires:

  1. A running TeamCity server.
  2. At least one TeamCity agent with Docker installed.
  3. A repository for storing build configurations as code.

Example

The following code sample demonstrates how to integrate Dagger with TeamCity. The code is written using the TeamCity Kotlin DSL.

kotlin

The following is a more complex example demonstrating how to create a TeamCity build that checks out source code, calls a Dagger Function to test the project, and then calls another Dagger Function to build and publish a container image of the project. This example uses a simple Go application and assumes that you have already forked it in the repository connected to the TeamCity project.

kotlin

Resources

About TeamCity

TeamCity is a popular CI/CD tool developed by JetBrains.