Jerzy Gruszka
Jerzy Gruszka

Reputation: 1759

Artifacts for failed builds in Gitlab

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.

Upvotes: 54

Views: 53329

Answers (3)

dganesh2002
dganesh2002

Reputation: 2220

Setting it as "always" also works. Might be useful for some seekers here :-)

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

Upvotes: 12

DV82XL
DV82XL

Reputation: 6639

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

Upvotes: 94

Kyle Spiers
Kyle Spiers

Reputation: 379

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

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

Upvotes: 37

Related Questions