summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-03-13 14:00:14 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-03-13 14:00:14 +0100
commit0cf0a7a898f06fc2a154683e76dc9199832c01c8 (patch)
tree53444ffaea62bfc5d10f552e6031d8f8128656dc /app/models/project.rb
parenta4a29e2ee1970d939a8b9ea9853261120c2eff3d (diff)
downloadgitlab-ce-0cf0a7a898f06fc2a154683e76dc9199832c01c8.tar.gz
DRY project-level predefined variables
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 9ca859c5879..85a4d570e9a 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1581,21 +1581,21 @@ class Project < ActiveRecord::Base
variables.append(key: 'CI_PROJECT_NAMESPACE', value: namespace.full_path, public: true)
variables.append(key: 'CI_PROJECT_URL', value: web_url, public: true)
variables.append(key: 'CI_PROJECT_VISIBILITY', value: visibility, public: true)
+ variables.concat(container_registry_variables)
+ variables.concat(auto_devops_variables)
end
end
def container_registry_variables
- return [] unless Gitlab.config.registry.enabled
+ Gitlab::Ci::Variables::Collection.new.tap do |variables|
+ return variables unless Gitlab.config.registry.enabled
- variables = [
- { key: 'CI_REGISTRY', value: Gitlab.config.registry.host_port, public: true }
- ]
+ variables.append(key: 'CI_REGISTRY', value: Gitlab.config.registry.host_port, public: true)
- if container_registry_enabled?
- variables << { key: 'CI_REGISTRY_IMAGE', value: container_registry_url, public: true }
+ if container_registry_enabled?
+ variables.append(key: 'CI_REGISTRY_IMAGE', value: container_registry_url, public: true)
+ end
end
-
- variables
end
def secret_variables_for(ref:, environment: nil)
@@ -1624,7 +1624,7 @@ class Project < ActiveRecord::Base
def auto_devops_variables
return [] unless auto_devops_enabled?
- (auto_devops || build_auto_devops)&.variables
+ (auto_devops || build_auto_devops)&.predefined_variables
end
def append_or_update_attribute(name, value)