Is there a way to CI 'latest artifact' link work also for failed jobs?

Hi guys! I started using one COMMON URL to access the last job artifacts (not to go to CI/CD → pipelines → job → artifacts → first directory → second directory → report.html for every single job).

https://docs.gitlab.com/ee/ci/pipelines/job_artifacts.html#access-the-latest-job-artifacts-by-url

Unfortunately it works only for jobs, which was succeeded :frowning:
My job is responsible for running automated tests, so I’d like to use this common url to access html test report almost always for failed jobs.
Is there a way to custom this feature to work for both success and failed jobs?
It would be veeeery useful.

Cheers,
Basia

Hi @basiex

I think you probably need to set artifacts.when to always. There’s an example in these docs.

HTH,

Sarah

Hi @snim2!
Thank you for your response, but this is not the problem - my job (both succedeed and failed) produces artifacts and with standard link (which contains job id) it works properly.

What I mean is - that universal link (I added link to a gitlab article how to create it) to latest artifact file refers only to last succedeed jobs.

Cheers!

Ah! Sorry, I misread you. I could be wrong, but I’m not sure that what you want is currently possible. In practice, I have always taken a URL from the particular job whose artefacts I wanted to see.

If you haven’t set this up already, it is possible to make your lint / test results appear in the “overview” page of your MRs, as if the results came from a unit testing library. All you need to do is to be able to ensure the output is in JUnit format, which many lints/testing libraries are able to do. Of course, this doesn’t always work if you want results in a format like a heatmap over a webpage.

I am having the same issue: one hack is to make sure you pipeline never fails e.g. by running pytest || true and then relying on generated artifacts to produce badges etc.

There is this issue people might want to upvote: Allow downloading artifacts from the API for failed jobs and pipelines (#368626) · Issues · GitLab.org / GitLab · GitLab