KICS Checkmarx 与 Azure Pipeline

问题描述 投票:0回答:2

我计划使用

KICS by Checkmarx
扫描
Terraform
基础设施代码。 这是我网上找的例子
https://docs.kics.io/1.3.1/integrations_azurepipelines/#integrate_kics_with_azure_pipelines

但是,我在

Azure DevOps
发布管道中使用它时遇到了一些困难。

如果有人使用 Azure Pipelines 将其用于 terraform,请告诉我。如果我得到一些指示,那将会有很大的帮助。

这是我到目前为止所尝试的:

出现此错误:

azure terraform azure-pipelines-release-pipeline infrastructure-as-code checkmarx
2个回答
1
投票

您正在查看非常过时的文档版本。

以下是最新版本的 Azure DevOps Integration 的链接: https://docs.kics.io/latest/integrations_azurepipelines/


0
投票

您面临的问题是您从 KICS 文档复制的代码不仅仅是一个简单的脚本:它是 Azure DevOps 管道的示例代码。 在 Azure DevOps 中,您可以执行两种管道:

  • 经典用户界面
  • YAML 管道

您可以在线检查两者之间的差异,但简而言之,“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)并复制粘贴它。 从上到下,这条管道的作用是:

  • 每当“master”分支更新时都会触发
  • 必须使用代理“ubuntu-latest”
  • container:此字段告诉系统从 Docker Hub 获取 Docker 映像(在本例中为 checkmarx/kics:debian 映像),然后启动容器
  • 其余步骤在容器内部执行(正在执行 kics)
© www.soinside.com 2019 - 2024. All rights reserved.