diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-12 16:00:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-12 16:00:22 +0300 |
commit | f7743c4d16e665a89e5d65d77f2d9f44bce9eb2d (patch) | |
tree | 68adcbef6d331adf26afa6e5301b7ed19d02e3be | |
parent | 280be6314fd87fd5bae773159a8922a265992cf1 (diff) |
Add latest changes from gitlab-org/gitlab@16-2-stable-ee
-rw-r--r-- | lib/gitlab/ci/pipeline/chain/validate/abilities.rb | 4 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/pipeline/chain/validate/abilities_spec.rb | 33 |
2 files changed, 37 insertions, 0 deletions
diff --git a/lib/gitlab/ci/pipeline/chain/validate/abilities.rb b/lib/gitlab/ci/pipeline/chain/validate/abilities.rb index b8b70a6b6b6..1939b1ff395 100644 --- a/lib/gitlab/ci/pipeline/chain/validate/abilities.rb +++ b/lib/gitlab/ci/pipeline/chain/validate/abilities.rb @@ -18,6 +18,10 @@ module Gitlab return error('Pipelines are disabled!') end + if project.import_in_progress? + return error('Import in progress') + end + unless allowed_to_create_pipeline? return error('Insufficient permissions to create a new pipeline') end diff --git a/spec/lib/gitlab/ci/pipeline/chain/validate/abilities_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/validate/abilities_spec.rb index df18e1e4f48..c3516c467d4 100644 --- a/spec/lib/gitlab/ci/pipeline/chain/validate/abilities_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/chain/validate/abilities_spec.rb @@ -82,6 +82,39 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Validate::Abilities, feature_categor specify { expect(step.perform!).to contain_exactly('Project is deleted!') } end + + context 'with project imports in progress' do + let(:project) { create(:project, :import_started, import_type: 'gitlab_project') } + + before do + step.perform! + end + + it 'adds an error about imports' do + expect(pipeline.errors.to_a) + .to include /Import in progress/ + end + + it 'breaks the pipeline builder chain' do + expect(step.break?).to eq true + end + end + + context 'with completed project imports' do + let(:project) { create(:project, :import_finished, import_type: 'gitlab_project') } + + before do + step.perform! + end + + it 'does not invalidate the pipeline' do + expect(pipeline).to be_valid + end + + it 'does not break the chain' do + expect(step.break?).to eq false + end + end end describe '#allowed_to_write_ref?' do |