Skip to content

Commit

Permalink
docs: adding teamcity integration example (#4259)
Browse files Browse the repository at this point in the history
  • Loading branch information
rogeriopeixotocx authored Sep 24, 2021
1 parent 5141c58 commit 91e07e3
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 0 deletions.
Binary file added docs/img/teamcity-scan-logs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/teamcity-success-status.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Integrate KICS with:
- [Github Actions](integrations_ghactions.md)
- [GitLab CI](integrations_gitlabci.md)
- [Jenkins](integrations_jenkins.md)
- [TeamCity](integrations_teamcity.md)
- [Travis](integrations_travisci.md)
- More soon...

The pipelines examples can be found in our [GitHub Repository](https://github.com/Checkmarx/kics/tree/master/examples)
42 changes: 42 additions & 0 deletions docs/integrations_teamcity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Running KICS in TeamCity

You can integrate KICS into TeamCity pipelines easily by [Kotlin DSL](https://www.jetbrains.com/help/teamcity/2021.2/kotlin-dsl.html) 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](https://www.jetbrains.com/help/teamcity/2021.2/setting-up-and-running-additional-build-agents.html) has Docker configured to run containers.

Checkout [Getting Started with Kotlin DSL](https://www.jetbrains.com/help/teamcity/2021.2/kotlin-dsl.html#Getting+Started+with+Kotlin+DSL) and modify you `.teamcity/settings.kts` as the example:

```kotlin
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](https://www.jetbrains.com/help/teamcity/2021.2/storing-project-settings-in-version-control.html#SynchronizingSettingswithVCS) enabled, after pushing the changes to the repository you'll be able to see the build progress, logs and success status.

<img src="https://raw.githubusercontent.com/Checkmarx/kics/master/docs/img/teamcity-scan-logs.png" width="850">

<img src="https://raw.githubusercontent.com/Checkmarx/kics/master/docs/img/teamcity-success-status.png" width="850">
26 changes: 26 additions & 0 deletions examples/teamcity/settings.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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()
}
}
})


1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ nav:
- Github Actions: integrations_ghactions.md
- Gitlab CI: integrations_gitlabci.md
- Jenkins: integrations_jenkins.md
- TeamCity: integrations_teamcity.md
- Travis CI: integrations_travisci.md
- AWS CDK: cdk.md
- Badge: BADGE.md
Expand Down

0 comments on commit 91e07e3

Please sign in to comment.