【问题标题】:Make pipeline fail when npm audit detects dependencies当 npm audit 检测到依赖项时使管道失败
【发布时间】:2022-08-18 22:17:59
【问题描述】:


我在我的 gitlab CI 上使用 npm audit,一切正常我创建了一个 json,其中包含要更新的依赖项列表。
现在,我希望这个管道在每次依赖项过时时都会失败。
在其他语言上,我们有 php/pip 使管道失败
任何想法 ?

  image: \"registry.gitlab.com/gitlab-org/security-products/analyzers/npm-audit:1.4.0\"
  stage: security-check
  variables:
    TOOL: npm
  script:
    - /analyzer run
  artifacts:
    reports:
      dependency_scanning: gl-dependency-scanning-report.json
    paths:
      - gl-dependency-scanning-report.json

    标签: javascript npm dependencies audit


    【解决方案1】:

    您可以使用作业中的allow_failure 选项添加允许或不允许失败的选项。

    您可以使用以下命令将此添加到您的安全检查作业中:

      image: "registry.gitlab.com/gitlab-org/security-products/analyzers/npm-audit:1.4.0"
      stage: security-check
      variables:
        TOOL: npm
      allow_failure: false
      script:
        - /analyzer run
      artifacts:
        reports:
          dependency_scanning: gl-dependency-scanning-report.json
        paths:
          - gl-dependency-scanning-report.json
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-10-25
      • 1970-01-01
      • 2016-06-23
      • 2020-02-25
      • 2012-07-15
      • 2018-04-02
      相关资源
      最近更新 更多