diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index ed8b30dae49..359a87a3f77 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -108,7 +108,11 @@ module Ci end def assign_to(project, current_user = nil) - self.is_shared = false if shared? + if shared? + self.is_shared = false if shared? + self.runner_type = :project_type + end + self.save project.runner_projects.create(runner_id: self.id) end diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb index eb59ba7cbe9..49d096ebb39 100644 --- a/spec/models/ci/runner_spec.rb +++ b/spec/models/ci/runner_spec.rb @@ -207,6 +207,7 @@ describe Ci::Runner do end it { expect(shared_runner).to be_specific } + it { expect(shared_runner).to be_project_type } it { expect(shared_runner.projects).to eq([project]) } it { expect(shared_runner.only_for?(project)).to be_truthy } end