summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorKamil TrzciƄski <ayufan@ayufan.eu>2018-05-11 08:13:27 +0000
committerFilipa Lacerda <filipa@gitlab.com>2018-05-11 10:45:06 +0100
commitc9a6f7cb401de7f04a66aec7198e9bd4a5fa615b (patch)
tree7ca1f141cadf3ff722d0708ae51c1cbb1a55081a /app
parent04ab2f1f021ff4f3e732da6ebbdfcb967c63f037 (diff)
downloadgitlab-ce-c9a6f7cb401de7f04a66aec7198e9bd4a5fa615b.tar.gz
Merge branch 'correct-runner-type-when-assigning-shared-to-project' into 'master'
Ensure runner_type is updated correctly when assigning shared runner to project See merge request gitlab-org/gitlab-ce!18874
Diffstat (limited to 'app')
-rw-r--r--app/models/ci/runner.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb
index 23078f1c3ed..9b76817b4c8 100644
--- a/app/models/ci/runner.rb
+++ b/app/models/ci/runner.rb
@@ -107,7 +107,13 @@ 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
+ elsif group_type?
+ raise ArgumentError, 'Transitioning a group runner to a project runner is not supported'
+ end
+
self.save
project.runner_projects.create(runner_id: self.id)
end