Skip to content

Artifacts links by job name is broken when last pipeline doesn't have the job

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

This is about the special link feature of Gitlab, which allows to create web URLs to browse or download directly for instance the last artifacts of a given job for a given branch: https://docs.gitlab.com/ee/ci/pipelines/job_artifacts.html#access-the-latest-job-artifacts-by-url

It works well except I realized that it only works if the named job is present in the last build of the given branch. This is a problem for long-running jobs which we prefer not to run at each commit for efficiency (not waiting 2 hours to know you have a problem) and resource saving, and which could be set as scheduled jobs for instance.

When the last build doesn't have the job, the link returns a 404.

Steps to reproduce

  • Create a job with artifacts, but don't make it run at normal "push" pipelines.
  • Run the pipeline with the job manually some of the other ways (schedules or create a pipeline manually setting some variables or whatnot). Result: at this point your special link works.
  • Now run the pipeline without the job (for instance by pushing some data).

Example Project

We have this issue on GIMP. I created jobs to build a Windows installer, but since it takes nearly 3 hours (because of these specific jobs, otherwise the whole pipeline takes 30 min), I don't include them in normal commits, only as schedule (or manual jobs).

For instance this link is supposed to return the artifacts with the installer: https://gitlab.gnome.org/GNOME/gimp/-/jobs/artifacts/master/browse/build/windows/installer/_Output?job=win-installer-nightly

Except it was working yesterday (because I had just created some pipelines containing the job) and I realize it doesn't anymore. I can access the other jobs from the last pipeline but not the win-installer-nightly job. This other one works fine for instance right now: https://gitlab.gnome.org/GNOME/gimp/-/jobs/artifacts/master/browse/?job=gimp-distcheck-debian

What is the current bug behavior?

The special links only look up the absolute last successful pipeline from the branch, whether or not it contains the job.

What is the expected correct behavior?

I was expecting it looks up the last successful pipeline containing the job from the branch (so it may not be the absolute last pipeline).

I am considering this a bug because for me, this is part of the whole point of these special URLs, not to have to dig into the CI list and search for jobs manually. And it is the normal logics of Gitlab pipelines to be different depending on various rules. So when we say we want the last artifacts for a job, it implies obviously to look up the last pipelines containing it.

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Whatever is on gitlab.gnome.org (I don't have access to admin details AFAIK).

Edited by 🤖 GitLab Bot 🤖