【发布时间】:2021-05-31 16:26:14
【问题描述】:
我的 .gitlab-ci.yml 文件如下:
image: cypress/base:14.16.0
stages:
- test
test:
stage: test
script:
- npm install
- npm run scripts
脚本在哪里 --> cypress run --spec cypress/integration/UI/myScript.feature
在脚本参数后添加另一个命令以生成诱惑报告时,gitlab 管道向我抛出一个错误,即未设置 JAVA 主路径以生成诱惑报告。
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH
所以我将我的脚本更新为如下内容:
image: cypress/base:14.16.0
stages:
- test
- allure
test:
stage: test
script:
- npm install
- npm run clean:allure
- npm run scripts
allure_report:
stage: allure
when: always
image: timbru31/java-node
dependencies:
- test
script:
- npm install
- npm run generate-allure-report
artifacts:
when: always
paths:
- cypress/reportsAllure/allure-report/
- cypress/reportsAllure/allure-results/
generate-allure-report 在哪里 --> allure generate cypress/reportsAllure/allure-results --clean -o cypress/reportsAllure/allure-report
但这里会生成空报告。有谁知道我需要从第一阶段传递到下一个阶段的哪些工件才能生成魅力报告?
【问题讨论】:
-
错误是什么?我还建议将
npm install作为一个步骤,将npm run scripts作为另一个步骤,在我看来,分离会让它更容易理解。 -
我收到未设置 JAVAHOME 的错误。这意味着 allure 需要在运行它的映像中包含 Java。那么如何在 .yml 中使用 2 张图片呢?
-
我在这篇文章中遇到过,他们在保留魅力数据和趋势方面的方法略有不同...medium.com/testvagrant/…
-
你也可以移动
image: cypress/base:14.16.0到test:因为那个阶段不需要任何 java ,由于你使用的 npm 包,诱惑结果正在发生,但是 @987654331 @ 需要安装了 java + allure 的图像(我看不到任何安装 allure 的尝试,所以很难理解你将如何打开 allure-results > allure-report)。
标签: continuous-integration gitlab-ci cypress pipeline allure