【发布时间】:2019-09-17 15:02:15
【问题描述】:
我正在尝试在 Gitlab CI 中运行机器人框架测试并将生成的报告作为工件下载。到目前为止,我已经成功运行了管道中的测试并生成了工件,但是生成的 zip 是空的。我错过了什么?
这是我的 Dockerfile:
FROM ppodgorsek/robot-framework:latest
COPY resources /opt/robotframework/resources
COPY tests /opt/robotframework/tests
COPY libs /opt/robotframework/libs
这是我在 gitlab-ci.yml 中的阶段:
run robot tests dev:
variables:
# more variables
ROBOT_OPTIONS: "--variable ENV:dev -e FAIL -e PENDING"
allow_failure: true
services:
- name: docker:dind
stage: run-robot-tests
image: docker:latest
script:
- mkdir -p reports
# mode docker run commands
- docker -H $DOCKER_HOST run --rm --network localnet --env "ROBOT_OPTIONS=${ROBOT_OPTIONS}" -v reports:/opt/robotframework/reports --name robot $CONTAINER_DEV_IMAGE
artifacts:
name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}
paths:
- reports/
when: always
tags:
- d-i-d
only:
refs:
- dev
我省略了一些特定于我们项目的细节。 但只是为了让您了解我们的设置,我们正在提取 docker 镜像 ppodgorsek/robot-framework 并使用它对另一个运行我们项目前端的 docker 容器运行测试。为了确保所有容器都在同一个网络上,我们使用了 docker-in-docker。我们的后端容器和数据库也在同一个网络中。
这是我工作输出的尾部。
==============================================================================
Tests | PASS |
3 critical tests, 3 passed, 0 failed
3 tests total, 3 passed, 0 failed
==============================================================================
Output: /opt/robotframework/reports/output.xml
Log: /opt/robotframework/reports/log.html
Report: /opt/robotframework/reports/report.html
Uploading artifacts...
reports/: found 1 matching files
Trying to load /builds/automation/system-tests.tmp/CI_SERVER_TLS_CA_FILE ...
Dialing: tcp gitlab.surfnet.nl:443 ...
Uploading artifacts to coordinator... ok id=42435 responseStatus=201 Created token=g8cWYYun
Job succeeded
您可以看到运行测试的控制台输出,然后您可以看到机器人存储生成的输出的位置。 接下来它显示工件已生成,它是,唯一的问题是它是空的。
【问题讨论】:
-
可以添加工作日志吗?
-
我已将输出包含在我的问题中。 :)
标签: docker gitlab robotframework gitlab-ci artifacts