Skip pipeline IID allocation on CI lint dry runs

What does this MR do and why?

Gitlab::Ci::Pipeline::Chain::Seed#perform! called pipeline.ensure_project_iid! unconditionally, which allocates an IID via an UPDATE on internal_ids and takes a row lock on the project.

For CI lint dry runs and linting the pipeline is never persisted, so GET /projects/:id/ci/lint issued this write on every request.

This MR guards the allocation with command.readonly? (dry_run? || linting?), matching the existing gating in Chain::Helpers and Chain::Skip. As a result CI_PIPELINE_IID is blank during linting, consistent with CI_PIPELINE_ID and CI_PIPELINE_CREATED_AT which are already unavailable for a non-persisted pipeline.

ensure_ci_ref! is intentionally left unchanged.

Related to #628136 (closed)

How to set up and validate locally

  1. Run the specs:
bundle exec rspec spec/lib/gitlab/ci/pipeline/chain/seed_spec.rb
bundle exec rspec spec/requests/api/lint_spec.rb

MR acceptance checklist

  • I have evaluated the MR for the breaking change impact.
  • Tests added for the new behavior (unit + request-level regression).

Merge request reports

Loading
Loading