TeamCity (CI/CD)
Overview
Section titled “Overview”TeamCity is a CI/CD server by JetBrains that supports pipelines configured via the UI or Kotlin DSL (configuration-as-code). It integrates with Git providers (GitLab, GitHub, Azure Repos), offers rich test/artifact reporting, and scales horizontally with build agents.
- Great for .NET, Java, and Node monorepos
 - Kotlin DSL makes changes reviewable and reproducible
 - Strong caching, test history, and build chains
 
Key concepts
Section titled “Key concepts”- Server: orchestrates projects and build configurations
 - Build Agents: workers that execute jobs; match via agent requirements
 - Projects & Build Configurations: pipeline hierarchy and steps
 - VCS Roots: connections to repositories
 - Parameters: build-time variables (env.*) and references (%param%)
 
Architecture
Section titled “Architecture”- VCS change triggers a build on the server
 - Server assigns work to an available agent matching requirements
 - Steps run (e.g., npm ci; npm run build) and artifacts are published
 - Status is reported back (e.g., to GitLab MRs)
 
Getting started
Section titled “Getting started”- Create a Project and set a VCS Root (GitLab/GitHub)
 - Add a Build Configuration
 - Choose UI steps or enable Kotlin DSL and commit settings
 - Install build agents; tag agents (e.g., windows, linux) for targeted jobs
 
Kotlin DSL example (settings.kts)
Section titled “Kotlin DSL example (settings.kts)”version = "2024.03"
project {  vcsRoot(GitVcsRoot {    id("BankyBlueprintsRepo")    name = "bankyblueprints"    url = "https://git.example.com/BankyTech/bankyblueprints.git"    branch = "refs/heads/main"  })
  buildType(BuildType {    id("Build_Site")    name = "Build Astro Site"
    vcs {      root(DslContext.settingsRoot)      root("BankyBlueprintsRepo")      cleanCheckout = true    }
    steps {      script {        name = "Install"        scriptContent = "npm ci"      }      script {        name = "Build"        scriptContent = "npm run build"      }    }
    triggers { vcs {} }
    artifactRules = "dist=>site"  })}Tips:
- Cache Node.js and package manager caches between builds
 - Use agent requirements to target OS/tooling
 - Use parameters for secrets; prefer secure parameters where possible
 
GitLab integration
Section titled “GitLab integration”- Use VCS Root to connect to GitLab
 - Add Commit Status Publisher to report pass/fail to Merge Requests
 - Optionally mirror pipelines by triggering from GitLab webhooks
 
See: ./teamcity/gitlab-integration
Subpages
Section titled “Subpages”- Introduction: ./teamcity/introduction
 - Build configurations: ./teamcity/build-configurations
 - GitLab integration: ./teamcity/gitlab-integration
 - Parameters: ./teamcity/parameters
 - Templates: ./teamcity/templates
 - VCS Roots: ./teamcity/vcs-roots
 
Best practices
Section titled “Best practices”- Prefer Kotlin DSL for maintainability and code review
 - Pin tool and runner versions; leverage caches
 - Use snapshot dependencies to orchestrate multi-project builds
 - Keep build steps idempotent and fast