The Simplest Way to Make Pagerduty and Teamcity Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Linking pagerduty and teamcity lets your build server wake up the right engineer when deploys fail. This workflow routes broken build alerts to on-call teams and clears incidents when builds pass. Many teams rely on chat messages or emails to track broken main branch builds. Those messages get buried fast during busy release windows. Tying your build server to your incident response app turns silent build failures into clear tasks. Engineers get paged only when critical release pipelines break

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Linking pagerduty and teamcity lets your build server wake up the right engineer when deploys fail. This workflow routes broken build alerts to on-call teams and clears incidents when builds pass.

Many teams rely on chat messages or emails to track broken main branch builds. Those messages get buried fast during busy release windows. Tying your build server to your incident response app turns silent build failures into clear tasks. Engineers get paged only when critical release pipelines break in production.

How pagerduty and teamcity share alerts and permissions

TeamCity watches your code repos and runs tests on every commit. When a critical build step fails, the server generates a failure event. It sends an outbound web request to the PagerDuty events endpoint over HTTPS. This payload includes the build name, failure reason, and a link to the build log.

PagerDuty checks the routing key inside the message to verify the sender. That key maps the alert to one specific service inside your incident app. The service then follows your team schedule to page the right on-call person. Each build plan uses a unique key so alerts land on the owning team.

Data can also flow back the other way when incidents start. PagerDuty can send outgoing webhooks to trigger recovery builds or rollback jobs in TeamCity. This requires a dedicated user account or token inside your build server. Keep that token scoped to only run the specific recovery job.

Fixing common failure modes and scoping roles

The biggest mistake teams make is sharing one global key across all build projects. When one key routes every alert, a minor test failure wakes up the wrong engineer. On-call fatigue sets in fast when noisy builds trigger midnight pages. Give each core service its own routing key and its own alert rules.

Shared admin accounts create another big risk between these two tools. Teams often create one broad token in TeamCity for external webhooks to use. If that token leaks, an attacker can read source code or change build steps. Create a dedicated role that can only trigger one specific project.

End-to-End Encryption + PagerDuty Integration Security: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Unlogged actions during an active incident also hurt your security posture. When an engineer gets paged, they often log into the build server to fix things. If multiple people share a single login, the audit trail breaks down. Map every user to your identity provider so every build action shows a real name.

Best practices for reducing alert noise

Not every broken build deserves a phone call in the middle of the night. Feature branch failures should only send a quiet message to the author. Save PagerDuty alerts for main branch breaks, failed production deploys, and broken rollback jobs. This keeps your incident channel clean and high signal.

Set up automatic resolution so fixed builds close their own open incidents. TeamCity can send a resolve event using the same incident key when the next build passes. If a flaky test passes on retry, the alert clears itself right away. Your on-call engineer can stay focused on real production outages.

Review your build logs for sensitive data before you forward them in alert payloads. Build output sometimes prints customer emails, phone numbers, or card numbers during failed tests. Configure your log filters so data masking rewrites matched fields in results before sending alerts out. Clean logs protect user privacy while giving responders the context they need.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

How do we stop flaky tests from paging the on-call engineer?

Configure TeamCity to retry failed tests before marking the whole build as failed. Only send an alert to PagerDuty after the final retry fails on a main branch.

Can a green build in TeamCity close a PagerDuty incident on its own?

Yes, TeamCity can send a resolve event when the same build config succeeds. Match the deduplication key from the original failure alert so PagerDuty closes the right incident.

What permissions should the integration account have in TeamCity?

If PagerDuty only receives alerts, it needs zero permissions inside your build server. If PagerDuty triggers rollback builds, give its token permission to run only that single project.

The query runs. The emails stay hidden.