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

I got troubles persisting my cypress test results as pipeline artifacts. I can verify, that the folder

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745558824a4632981.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信