Newman 报告生成在本地有效,但在 CI 中无效

Newman report generation works locally but not from CI

我有一个 GitLab CI 作业 运行 使用自定义环境处理一系列 Postman 请求。我正在使用 Newman 运行 它们与 newman-reporter-htmlextra npm 插件一起生成测试报告。

作业如下所示:

postman-tests:
  stage: postman-tests
  image: 
    name: wojciechzurek/newman-ci
  before_script:
    - cd ci/tests/postman
    - npm install -g newman-reporter-htmlextra
  script:
    - newman run Non-regression_tests.postman_collection.json -e Tests.postman_environment.json \
      --reporters htmlextra --reporter-htmlextra-export newman-results.html
    - ls -la # Check report generation
  artifacts:
    when: always
    paths:
      - newman-results.html
  allow_failure: true

当我 运行 newman 在我的 mac (newman 4.5.0) 上时,请求和相关测试 运行 正确并生成报告。但是,作业失败并且未生成报告:

 $ newman run Non-regression_tests.postman_collection.json -e Tests.postman_environment.json --reporters htmlextra --reporter-htmlextra-export newman-results.html --color

Uploading artifacts...

WARNING: newman-results.html: no matching files    
ERROR: No files to upload                          
ERROR: Job failed: exit code 1

看来这个问题可能是由测试系列本身引起的,而不是报告生成引起的,因为即使我不生成报告,作业也会失败。

我尝试了不同的 运行ners:Docker 使用官方 newman 图像、SSH 和 shell 在我安装 newman 的 machines 上(版本 4.5.6)和 htmlextra 记者事先。全部失败。
有趣的是,当 运行 在 SSH 和 shell [=37] 后面的 machines 本地 运行 时,测试系列和报告生成 都成功了=]ners,但是从 GitLab CI.

启动时它们确实失败了

我 forget/do 有什么错误阻止了 GitLab CI 生成测试报告?

我的 .yml 用于测试,看起来像这样 - 它非常基本,但我刚刚 运行 再次使用并且 运行 很好:

stages:
    - test

newman_tests:
    stage: test
    image: 
        name: postman/newman_alpine33
        entrypoint: [""]
    script:
        - newman --version
        - npm install -g newman-reporter-htmlextra
        - newman run collection.json -e environment.json --reporters cli,htmlextra --reporter-htmlextra-export testReport.html
    artifacts:
        when: always
        paths:
            - testReport.html

我确实拥有的一件事是 entrypoint: [""]image 块中。