Getting JUnit report out of CI images

mikko.ropanen
mikko.ropanen Spryker Solution Partner Posts: 31 ✨ - Novice

Hi, by default the CI image deploy.ymls use docker:mount:baked, so the generated test reports are not exposed to the CI host.

Is there some clever way to get the test reports out as an artifact?

Note: this is mostly for Gitlab using the Docker-in-Docker setup described here https://docs.spryker.com/docs/ca/dev/configure-deployment-pipelines/configure-gitlab-pipelines.html

Answers

  • mikko.ropanen
    mikko.ropanen Spryker Solution Partner Posts: 31 ✨ - Novice

    So what I ended up doing in .gitlab-ci.yml:

        artifacts:
            when: always
            reports:
                junit: $JUNITREPORT
    …
    after_script:
        - docker cp $(docker ps -aqf "name=^.*cli_1$"):/data/$JUNITREPORT $JUNITREPORT
    

    The tricky part was finding out the container id, but eventually I found out you can do this to get the id of a running Docker container whose name ends in "cli_1":
    docker ps -aqf "name=^.*cli_1$"