Exclude readonly pipelines from Chain::Skip to prevent ActiveRecord::ReadOnlyRecord error

What does this MR do and why?

Adds a condition to Chain::Skip for readonly pipelines, which is causing an ActiveRecord::ReadOnlyRecord error.

This happens because during this part of the chain, if we have a pipeline.readonly, then calling pipeline.skip on it will raise this error.

The easiest way to recreate this is to do it in the CI editor and compare behaviors in main/master and this brach:

  1. Add the following script to a simple .gitlab-ci.yml:
job:
  script: ls
  rules:
    - if: $CI_PIPELINE_SOURCE == "schedule"
      when: never
    - when: on_success
  1. Check the network tab and you will see a failing graphql request with the error - Ci::Pipeline is marked as readonly

Screenshot 2025-08-06 at 3.44.19 PM.png

The linter will also either load infinitely or show an error: (it should probably not load infinitely but that's a FE problem for now):

Screenshot 2025-08-06 at 3.42.52 PM.png

which is because of ActiveRecord::ReadOnlyRecord error.

You can further verify this in the console:

pipeline = ::Ci::Pipeline.first # any pipeline will do
pipeline.readonly! # Make it readonly if it's not already
pipeline.skip # this is what we are trying to avoid in the MR

you will get the error: ActiveRecord::ReadOnlyRecord: Ci::Pipeline is marked as readonly

References

#428590 (closed)

MR acceptance checklist

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

Edited by Laura Montemayor

Merge request reports

Loading