Back to Dagger

TeamCity

docs/versioned_docs/version-1.0-beta/adopting/triggers/teamcity.mdx

0.21.52.0 KB
Original Source

TeamCity

TeamCity provides a Dagger Recipe that runs dagger check in any build configuration, so the same checks you run locally run on every build — while keeping all of your existing TeamCity infrastructure. The recipe is taken from the JetBrains Marketplace.

:::tip For checks with no build configuration at all, enable Cloud Checks with dagger ws autocheck on. The recipe below is the hybrid-mode alternative for when you want to drive Dagger from your existing TeamCity setup. :::

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 runs dagger check against the modules installed in your workspace and sends telemetry to Dagger Cloud if the DAGGER_CLOUD_TOKEN environment variable is set.
  6. The build completes successfully or fails based on the check results. 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, with a Dagger workspace (.dagger/config.toml) — see Workspace Setup.

Example

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

kotlin

Resources

About TeamCity

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