summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-05-11 08:13:27 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2018-05-11 08:13:27 +0000
commitf91aaccf4d0c182c01046ba38cbd9ed30b9d3684 (patch)
tree417d751687f9905e9db74b8b0945ea789fd645cc /app/models
parente6b8f89d280292d24ec4c3ec586933df1474cae7 (diff)
parentcd834b46a8b84eaf14891854925502800acff475 (diff)
downloadgitlab-ce-f91aaccf4d0c182c01046ba38cbd9ed30b9d3684.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/models')
-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 ed8b30dae49..bda69f85a78 100644
--- a/app/models/ci/runner.rb
+++ b/app/models/ci/runner.rb
@@ -108,7 +108,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