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:
- Add the following script to a simple
.gitlab-ci.yml:
job:
script: ls
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- when: on_success
- Check the network tab and you will see a failing
graphqlrequest with the error -Ci::Pipeline is marked as readonly
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):
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
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.

