Skip to content

Fix expired artifacts causing dependency failures on locked pipelines

What does this MR do?

This MR resolves GitLab bug# 293554. The bug is regarding jobs considering artifacts as expired even if the pipeline is locked because it's the newest one for the branch. Even if the artifacts for a locked branch are past the normal expiration date, they are kept until another successful build, so they should be used by any jobs that depend on them.

Closes #293554 (closed)

Screenshots or Screencasts (strongly suggested)

How to setup and validate locally (strongly suggested)

Based on original bug report:

  1. Define Job A with artifacts that has a short expire_in.
  2. Define Job B in another stage, that has a needs dependency on Job A. Let there be an error so the job will fail or set the job to be manually started.
  3. Run the pipeline.
  4. Let enough time pass that the artifacts from Job A would normally expire.
  5. Verify that the artifacts from Job A are in fact still available due to being latest for the job/branch.
  6. Retry Job B.
  7. Job B will fail with the error This job depends on other jobs with expired/erased artifacts: Job A Please refer to https://docs.gitlab.com/ee/ci/yaml/README.html#dependencies.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

I need assistance with resolving unit tests failures in spec/services/ci/register_job_service_spec.rb. The fix I did in the other unit tests is not working here and it's unclear if the failures in "stale" job test should be fixed in the same way, or if they are an actual issue with the code.

CC: @greg (asked me to ping him on this MR)

Related to #293554 (closed)

Edited by Vitali Tatarintev

Merge request reports