Newman 报告生成在本地工作,但不能从 CI 生成

ava*_*ula 3 docker gitlab-ci newman gitlab-ci-runner

我有一个 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
Run Code Online (Sandbox Code Playgroud)

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

 $ 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
Run Code Online (Sandbox Code Playgroud)

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

我尝试了不同的运行器:带有官方 newman 镜像的 Docker、SSH 和 shell,在我事先安装了 newman(版本 4.5.6)和 htmlextra 报告器的机器上。全部失败。
有趣的是,当在 SSH 和 shell 运行程序后面的计算机上本地运行时,测试系列和报告生成都会成功,但从 GitLab CI 启动时会失败。

我忘记/做错了什么导致无法从 GitLab CI 生成测试报告?

Dan*_*ton 5

我的.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
Run Code Online (Sandbox Code Playgroud)

我所拥有的一件事就是entrypoint: [""]image街区里。