最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

docker - Save Test Reports of Dockerized Cypress as Bitbucket Pipeline Artifacts - Stack Overflow

programmeradmin1浏览0评论

I got troubles persisting my cypress test results as pipeline artifacts. I can verify, that the folder cypress saves the reports to are correct.

there may be something going wrong with the volume mapping from container to pipeline workspace.

bitbucket yml

pipelines:
  custom:
    e2e:
      - step:
          services:
            - docker
          script:
            - mkdir -p cypress-reports/screenshots cypress-reports/mochawesome-report
            - docker-compose -f docker-compose.e2e.yml up -d
          artifacts:
            - cypress-reports/**

docker compose yml

services:
  cypress:
    build: 
      context: .
    volumes:
      - ./cypress-reports/screenshots:/cypress/screenshots
      - ./cypress-reports/mochawesome-report:/mochawesome-report

I got troubles persisting my cypress test results as pipeline artifacts. I can verify, that the folder cypress saves the reports to are correct.

there may be something going wrong with the volume mapping from container to pipeline workspace.

bitbucket yml

pipelines:
  custom:
    e2e:
      - step:
          services:
            - docker
          script:
            - mkdir -p cypress-reports/screenshots cypress-reports/mochawesome-report
            - docker-compose -f docker-compose.e2e.yml up -d
          artifacts:
            - cypress-reports/**

docker compose yml

services:
  cypress:
    build: 
      context: .
    volumes:
      - ./cypress-reports/screenshots:/cypress/screenshots
      - ./cypress-reports/mochawesome-report:/mochawesome-report
Share Improve this question asked Nov 19, 2024 at 13:31 neukoellnjennyneukoellnjenny 18012 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Assuming your Dockerfile features a RUN directive with a command that would produce the expected reports in a given time:

I'd bet your problem stems from the -d|--detach flag after the docker compose up command: it will immediately detach the pipeline runner shell from the command and, because it is the last command in your pipeline script, the pipeline step ends much before the background process can finish the artifacts.

I'd suggest you replace the docker compose up --detach by a docker compose run cypress instead, which will unequivocally wait for the command to end.

发布评论

评论列表(0)

  1. 暂无评论