TeamCity
TeamCity-Build-Step (Command Line):
#!/bin/bash
set -e
# Download
curl -sSL -H "Authorization: Bearer %env.CODEGUARD_API_KEY%" \
-o codeguard.zip \
https://codeguard.bochmann-software.com/api/v1/cli/1.4.0/linux-x64
unzip -q codeguard.zip -d codeguard-bin
chmod +x codeguard-bin/codeguard
# Analyze with TeamCity Service Messages
codeguard-bin/codeguard analyze . \
--fail-on error \
--output console \
2>&1 | tee codeguard.log
# Optionally publish as artifact
echo "##teamcity[publishArtifacts 'codeguard.log']"
API-Key
In TeamCity: Project → Parameters → Environment variable
CODEGUARD_API_KEY, "Password"-Type. Auf Project-Ebene damit alle
Build-Konfigurationen darauf zugreifen können.
Caching
// .teamcity/CodeGuard.kt (Kotlin DSL)
steps {
script {
name = "Restore cache"
scriptContent = """
mkdir -p ~/.cache/codeguard
# TeamCity Build Cache Plugin oder ähnliches
""".trimIndent()
}
}
Mit TeamCitys eingebauten Build-Caches könnt ihr
~/.cache/codeguard zwischen Builds persistieren.
Self-Hosted Agents
Funktioniert ohne Anpassungen. Der Agent braucht Internet zu
codeguard.bochmann-software.com oder ihr spiegelt das Binary in
ein lokales Artefakt-Repo.