Extend job archival mechanism to the whole pipeline

What does this MR do and why?

This merge request extends the job archival mechanism to the whole pipeline. It introduces the following changes:

  1. Adds an archived? method to the Ci::Pipeline model to check if a pipeline is archived based on the archive_builds_in_seconds setting.
  2. Updates the archived? method in the Ci::Build and CommitStatus models to consider the pipeline's archived status.
  3. Updates the pipeline policy to prevent pipeline_update permission if the pipeline is archived.
  4. Adds checks in various services to prevent modifications to archived pipelines following defense-in-depth

These changes are implemented to address the issue of long-running pipelines becoming stale and potentially causing performance issues. By extending the archival mechanism to the entire pipeline, we ensure that old pipelines are properly archived and cannot be modified, improving system performance and data consistency.

This implementation also maintains backwards compatibility by creating new pipelines for commit statuses when the existing pipeline is archived, instead of returning an error.

Related to #271614 (closed)

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Related to #271614 (closed)

Edited by Marius Bobin

Merge request reports

Loading