我计划使用
KICS by Checkmarx
扫描 Terraform
基础设施代码。
这是我网上找的例子https://docs.kics.io/1.3.1/integrations_azurepipelines/#integrate_kics_with_azure_pipelines
但是,我在
Azure DevOps
发布管道中使用它时遇到了一些困难。
如果有人使用 Azure Pipelines 将其用于 terraform,请告诉我。如果我得到一些指示,那将会有很大的帮助。
您正在查看非常过时的文档版本。
以下是最新版本的 Azure DevOps Integration 的链接: https://docs.kics.io/latest/integrations_azurepipelines/
您面临的问题是您从 KICS 文档复制的代码不仅仅是一个简单的脚本:它是 Azure DevOps 管道的示例代码。 在 Azure DevOps 中,您可以执行两种管道:
您可以在线检查两者之间的差异,但简而言之,“YAML 管道”是定义管道的较新方法(就像您可以在 GitLab、Github、Bitbucket 等中编写 YAML 管道一样)。
在第一个屏幕截图中,您使用“经典 UI”来定义管道,但您也可以在 YAML 中定义它,这或多或少是 KICS 文档提供的示例代码。
trigger:
- master
pool:
vmImage: "ubuntu-latest"
container: checkmarx/kics:debian
steps:
# running in CI mode, exporting results to a JSON file and printing the results in stdout
# KICS should fail the pipeline if results are found
- script: |
/app/bin/kics scan --ci -p ${PWD} -o ${PWD}
cat results.json
只需在存储库中创建一个 YAML 管道,为其指定任何名称(例如:azure-pipelines-kics.yaml)并复制粘贴它。 从上到下,这条管道的作用是: