Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: adding teamcity integration example #4259

Merged
merged 3 commits into from
Sep 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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