41

I would like to know how to generate artifacts for failed builds in gitlab continuous integration, to view the html report generated by the build.

I tried like this:

 artifacts:
    when: on_failure
      paths:
        - SmokeTestResults/
        - package.json

but it does not work unfortunately. I am using Gitlab 8.11.4 community edition.

Anthon
  • 69,918
  • 32
  • 186
  • 246
Jerzy Gruszka
  • 1,629
  • 4
  • 15
  • 20

2 Answers2

72

Using when: on_failure will upload the artifact only when there is a failure.

To always upload the artifact despite a failure, use when: always.

https://docs.gitlab.com/ce/ci/yaml/index.html#artifactswhen

davidvandebunte
  • 1,286
  • 18
  • 25
DV82XL
  • 5,350
  • 5
  • 30
  • 59
30

When, path, and the files should all be at the same level

artifacts:
  when: on_failure
  paths:
  - SmokeTestResults/
  - package.json
Kyle Spiers
  • 309
  • 3
  • 4