This guide adds Vibgrate drift scanning to a JetBrains TeamCity build configuration. It targets build administrators using TeamCity agents on Windows or Linux.
Prerequisites
- A TeamCity agent with Node.js 18+ available.
- A VCS root so the build checks out your repository.
Command-line build step
Add a Command Line build step with this script:
npx @vibgrate/cli scan --fail-on error
TeamCity checks out into the build working directory, so npx @vibgrate/cli scan scans the project root.
Failing the build
The step's exit code determines the build status. With --fail-on error, the scan returns non-zero on error-severity findings and TeamCity marks the build as failed. The Exit Codes reference lists the full mapping.
Drift budget gate
To gate on the overall DriftScore:
npx @vibgrate/cli scan --drift-budget 60
Build artifacts
Write a report and publish it via the configuration's Artifact paths:
npx @vibgrate/cli scan --format markdown --out drift-report.md
Then add drift-report.md to the artifact paths so reviewers can open it from the build results.
Caching
TeamCity agents are typically long-lived, so the Vibgrate cache persists across builds. For agent pools that recycle, mount a shared cache directory.
Related
- Required status checks for drift gates to enforce passing builds.
- Push scan results to Vibgrate Cloud from CI for trends.