Commit 7dfd2393 authored by Marius Bobin's avatar Marius Bobin

Merge branch 'sh-drop-blocked-user-build' into 'master'

Drop CI builds triggered by blocked user

See merge request gitlab-org/gitlab!83269
parents fed229f4 a9045670
......@@ -271,7 +271,8 @@ module Ci
runner_unsupported: -> (build, params) { !build.supported_runner?(params.dig(:info, :features)) },
archived_failure: -> (build, _) { build.archived? },
project_deleted: -> (build, _) { build.project.pending_delete? },
builds_disabled: -> (build, _) { !build.project.builds_enabled? }
builds_disabled: -> (build, _) { !build.project.builds_enabled? },
user_blocked: -> (build, _) { build.user&.blocked? }
}
end
end
......
......@@ -103,6 +103,20 @@ module Ci
pending_job.create_queuing_entry!
end
context 'when build owner has been blocked' do
let(:user) { create(:user, :blocked) }
before do
pending_job.update!(user: user)
end
it 'does not pick the build and drops the build' do
expect(execute(shared_runner)).to be_falsey
expect(pending_job.reload).to be_user_blocked
end
end
context 'for multiple builds' do
let!(:project2) { create :project, shared_runners_enabled: true }
let!(:pipeline2) { create :ci_pipeline, project: project2 }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment