PHASE 1 OF 15

CI/CD Concepts & TeamCity Architecture

What CI/CD actually solves, where TeamCity fits in the landscape, how the server-agent-database architecture works, and the key terms you need before touching the UI

CI/CDArchitectureConceptsTerminology
1

What is CI/CD?

Before the era of CI, developers worked in long-lived branches for weeks or months, then merged everything at once — the dreaded "integration hell." CI/CD solves this by automating the feedback loop: every commit triggers a build and test run, so failures are discovered within minutes, not weeks.

Continuous Integration (CI)

Automatically build and test code on every commit. Goals:

  • Detect broken code within minutes of the commit
  • Keep the main branch always in a buildable, tested state
  • Reduce merge conflicts by integrating small changes frequently
Continuous Delivery (CD)

Extend CI so that a passing build automatically produces a deployable artifact — and optionally deploys it to staging or production. Goals:

  • Every green build is a release candidate
  • Deployment is a push-button (or fully automated) operation
  • Reduce release risk through smaller, more frequent releases
The feedback loop
Developer ──commit──▶ VCS (GitHub) ──webhook/poll──▶ TeamCity ──queue──▶ Build Agent ──compile──▶ ──test──▶ ──package──▶ ◀──result + artifacts── ◀──commit status (✓/✗)── Developer notified // within 2–5 min of commit
2

TeamCity in the CI Landscape

TeamCity is a commercial CI/CD server by JetBrains. It competes with Jenkins (open-source), CircleCI (cloud), GitLab CI (built-in), and GitHub Actions. Each has trade-offs:

FeatureTeamCity 2017.2JenkinsCircleCIGitLab CI
HostingSelf-hostedSelf-hostedCloud / self-hostedCloud / self-hosted
UI qualityExcellentDated (pre-Blue Ocean)GoodGood
Build chain visualizationBuilt-in, visualPlugin requiredWorkflow YAMLPipeline YAML
Agent modelPull-based agentsPush + pullDocker containersRunners
Config as codeKotlin DSL (2017+)Jenkinsfile (Groovy)YAMLYAML
LicenseFree: 3 agents, 100 configsFree / open-sourcePaid tiersFree tier + paid
Plugin ecosystemGood (JetBrains-curated)Huge (1800+ plugins)OrbsBuilt-in heavy
Best forJVM teams, .NET teamsAny — highly flexibleCloud-native teamsGitLab users
TEAMCITY FREE TIER

TeamCity Professional is free for up to 3 build agents and 100 build configurations. This is sufficient for most small-to-medium teams. Enterprise license removes these limits and adds advanced features (LDAP, 2FA, more agent types).

3

TeamCity Architecture

TeamCity has three distinct components that work together. Understanding this prevents configuration mistakes later.

TeamCity Server // Central brain — web UI, config, DB, queue │ HTTP :8111 │ HTTPS :443 (optional) ├──▶ Database // Build history, users, config (not artifacts) │ MySQL / PostgreSQL │ (or internal HSQL for dev) ├──▶ Data Directory // File system: plugins, logs, artifacts, config XML │ .BuildServer/ └──▶ Build Agents // Workers — run the actual build steps Agent 1 (local) Agent 2 (remote server) Agent N (Docker / cloud) // Agents connect TO server, not the other way
The Server

Runs as a Java web application (Tomcat-based). Responsibilities:

  • Hosts the web UI and REST API
  • Stores all project/build configuration
  • Manages the build queue — decides which agent gets which build
  • Collects and displays build results, test reports, artifacts
  • Sends notifications
The Database

Stores build history, user accounts, statistics, and runtime data. The project/build configuration is also mirrored here from XML files. Never share a database between two TeamCity servers.

The Data Directory

A file-system directory (default: ~/.BuildServer on Linux, %USERPROFILE%\.BuildServer on Windows). Contains:

  • config/ — project and build configuration XML files
  • system/artifacts/ — published build artifacts
  • system/caches/ — VCS caches, agent caches
  • logs/ — server and agent logs
  • plugins/ — installed plugins (.zip files)
Build Agents

Separate Java processes that run build steps. Key facts:

  • Agents connect outbound to the server — no inbound firewall rules needed for agents behind NAT
  • Each agent has a working directory where source code is checked out
  • An agent can only run one build at a time (by default)
  • Agents report their system properties (OS, JDK version, tools) to the server for compatibility matching
GOTCHA — Server vs Agent resources

The TeamCity server does not run build steps — it only orchestrates. Never install your build tools (Maven, Node, Docker) on the server machine alone and expect builds to work. Build tools must be installed on the agent machines.

4

Key Terms Glossary

These terms appear everywhere in TeamCity. Get them clear before proceeding.

Project
A container for related build configurations, VCS roots, and parameters. Projects can be nested (parent/child). Think of it as a "folder" for a team or application.
Build Configuration
The blueprint for a specific build — which source to use, what steps to run, what to do on failure, what artifacts to produce. Analogous to a Jenkins Job.
VCS Root
Connection to a version control repository (GitHub, GitLab, SVN, etc.). Defines URL, credentials, branch spec, and checkout rules. Shared across build configurations in a project.
Build Step
A single unit of work inside a build — run Maven, execute a shell script, run tests. A build configuration has one or more steps executed in order.
Runner
The type of build step — Maven Runner, Gradle Runner, Command Line Runner, PowerShell Runner, etc. Each runner has specific configuration fields.
Artifact
Files published after a successful build (JARs, WARs, ZIPs, reports). Defined by artifact path patterns. Stored on the server and available for download or use by dependency builds.
Trigger
The rule that starts a build automatically — on VCS commit, on a schedule, when another build finishes, or on retry. Without a trigger, builds only run when started manually.
Build Agent
The machine that actually runs the build steps. Has a working directory, installed tools, and system properties that TeamCity uses for compatibility matching.
Build Queue
Pending builds waiting for a compatible agent. TeamCity assigns builds from the queue to available agents based on requirements and agent pools.
Build Feature
An optional add-on to a build configuration — code coverage, commit status publishing, SSH agent, Docker login, etc. Applied on top of build steps without modifying them.
Snapshot Dependency
Ensures that build B uses the same source snapshot as build A. Forms a build chain — A must complete before B starts.
Artifact Dependency
Copies artifacts from one build configuration into another before the build starts. Used to pass compiled JARs, config files, or reports between stages.
5

TeamCity 2017.2.2 — Notable Features

Version 2017.2 (released November 2017) introduced several important features this tutorial covers in detail:

FeatureWhat it doesCovered in
Two-factor authenticationTOTP-based 2FA for all usersPhase 13
Pull Request build featureAuto-detects and builds GitHub/Bitbucket PRsPhase 5, Phase 10
Kotlin DSL versioned settingsStore all project config as Kotlin code in VCSPhase 11, Phase 15
Composite build configurationsFan-in/fan-out build chains with aggregated resultsPhase 9
Docker support build featureDocker login/logout, image cleanup after buildPhase 10
Improved REST API (v10)New endpoints, better filtering, build chain APIPhase 14
Shared resourcesLock/semaphore for exclusive resource accessPhase 10
VERSION NOTE

The .2 in 2017.2.2 is a bugfix release. All major feature content in this tutorial applies to the full 2017.2.x line. The build number for 2017.2.2 is 51985. You can verify your version at Administration → Server Administration → Server Info.

6

Typical Commit-to-Artifact Workflow

This is the lifecycle of a single build, from the developer's commit to a published artifact:

1. Developer pushes commit ──▶ GitHub 2. GitHub fires webhook ──▶ TeamCity server (POST /app/rest/vcs-root-instances/checkingForChanges) or TeamCity polls VCS every N seconds (configured on VCS Root) 3. VCS trigger fires ──▶ Build added to the Build Queue 4. Agent becomes available ──▶ Server assigns build to agent 5. Agent checks out source ──▶ Working dir populated 6. Build steps execute Step 1: mvn compile Step 2: mvn test Step 3: mvn package 7. Artifact paths published ──▶ target/*.jar stored on server 8. Build result reported ──▶ UI updated (green/red) 9. Commit status published ──▶ GitHub PR shows ✓ or ✗ 10. Notifications sent ──▶ Email / Slack on failure

Total elapsed time from push to notification: typically 2–8 minutes for a Java project, depending on build duration and queue wait time.

7

Mental Model: Mapping a Build Script to TeamCity

If you have an existing build script, here's how its pieces map to TeamCity concepts:

In your script / workflowTeamCity equivalent
git clone https://github.com/org/repoVCS Root — defines the repo URL and credentials
git checkout feature-branchBranch specification on the VCS Root
export VERSION=1.2.3Environment variable parameter on build config
mvn clean packageBuild step with Maven runner
cp target/app.jar /artifacts/Artifact paths: target/app.jar
if [ $? -ne 0 ]; then notify; fiFailure condition + notification rule
Cron job: run nightly at 02:00Schedule trigger with cron expression
Run on every push to mainVCS trigger on branch refs/heads/main
Deploy only if tests passSnapshot dependency: Deploy config depends on Test config
KEY INSIGHT

TeamCity doesn't replace your build tool (Maven, Gradle, npm). It orchestrates them — triggering them at the right time, on the right machine, with the right parameters, and collecting their results. Your pom.xml or build.gradle stays exactly as is.

Up Next — Phase 2: Installation & Initial Setup

Install TeamCity on Windows or Linux, run the setup wizard, configure the database, install your first agent, and verify everything is working.

Continue to Phase 2 → Back to Hub