Skip to content

Running KICS in TeamCity

You can integrate KICS into TeamCity pipelines easily by Kotlin DSL and KICS docker image.

This provide you the ability to run KICS scans as a stage of your pipeline.

Just make sure that the TeamCity agent has Docker configured to run containers.

Checkout Getting Started with Kotlin DSL and modify you .teamcity/settings.kts as the example:

import jetbrains.buildServer.configs.kotlin.v2019_2.*
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script
version = "2021.1"

project {
    description = "KICS TeamCity integration test"
    buildType(Build)
}

object Build: BuildType({
    name = "KICS TeamCity integration test"
    vcs {
        root(DslContext.settingsRoot)
    }

    steps {
        script {
            scriptContent = """
                #!/bin/bash
                docker run -v ${'$'}PWD:/path checkmarx/kics:latest scan -p /path -o /path --no-progress --ignore-on-exit results
            """.trimIndent()
        }
    }
})

With versioned settings enabled, after pushing the changes to the repository you'll be able to see the build progress, logs and success status.