diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-09-11 15:20:59 +0200 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-09-11 15:20:59 +0200 |
commit | 71e951b23096bdc550eeba77a41b16a25a86eaee (patch) | |
tree | 76c9086da20b2094243725d395067dcc2c7d561d | |
parent | f924e0000fe538ce557725833e65470c21a3099c (diff) | |
download | gitlab-ce-71e951b23096bdc550eeba77a41b16a25a86eaee.tar.gz |
Fix API
-rw-r--r-- | app/models/ci/build.rb | 6 | ||||
-rw-r--r-- | app/models/ci/runner.rb | 41 |
2 files changed, 16 insertions, 31 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 24368a36a70..0806052499c 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -666,9 +666,9 @@ module Ci def all_tags_set all_tags_set = [] - all_tags_set << all_tags + ["project_#{self.project_id}"] - all_tags_set << all_tags + ["group_#{self.project.namespace_id}"] if self.project.group_runners_enabled? - all_tags_set << all_tags + ['shared'] if self.project.shared_runners_enabled? + all_tags_set << all_tags + ["*project_#{self.project_id}"] + all_tags_set << all_tags + ["*group_#{self.project.namespace_id}"] if self.project.group_runners_enabled? + all_tags_set << all_tags + ['*shared'] if self.project.shared_runners_enabled? all_tags_set end diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index 3cb1e09903c..07c392caf64 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -219,43 +219,28 @@ module Ci end end - def group_tags - return [] unless self.group_type? - - self.groups.pluck(:id).map do |group_id| - "group_#{group_id}" - end - end - - def project_tags - return [] unless self.project_type? - - self.projects.pluck(:id).map do |project_id| - "project_#{project_id}" - end - end - - def user_tags - self.tag_list.map do |tag_name| + def all_tags + all_tags = [] + all_tags += self.tag_list.map do |tag_name| "tag_#{tag_name}" end + all_tags << 'protected' if self.ref_protected? + all_tags << 'run_untagged' if self.run_untagged? + all_tags end - def all_tags - tags = [] - tags << 'shared' if self.instance_type? - tags += group_tags - tags += project_tags - tags += user_tags - tags << 'protected' if self.ref_protected? - tags << 'run_untagged' if self.run_untagged? - tags.map(&:to_s) + def tags_set + tags_set = [] + tags_set << ['*shared'] + all_tags if self.instance_type? + tags_set += self.projects.pluck(:id).map { |id| ["*project_#{id}"] + all_tags } if self.project_type? + tags_set += self.groups.pluck(:id).map { |id| ["*group_#{id}"] + all_tags } if self.group_type? + tags_set.map(&:sort) end def details { id: self.id, - tags_set: [all_tags].map(&:sort) + tags_set: tags_set } end |