diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-09-22 12:17:01 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-09-22 12:29:06 +0200 |
commit | 87637693acbd443c674bcbf26d87281156a70761 (patch) | |
tree | 5e9acb924d93b27c1485bb1e5fdcdc1fcda180d1 /app/models/project_services/kubernetes_service.rb | |
parent | 26607a1690631916baf5a39d198ff7096cb5bde6 (diff) | |
download | gitlab-ce-87637693acbd443c674bcbf26d87281156a70761.tar.gz |
Introduce CI/CD variables collection class
Diffstat (limited to 'app/models/project_services/kubernetes_service.rb')
-rw-r--r-- | app/models/project_services/kubernetes_service.rb | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/app/models/project_services/kubernetes_service.rb b/app/models/project_services/kubernetes_service.rb index 8ba07173c74..5c1a1063baa 100644 --- a/app/models/project_services/kubernetes_service.rb +++ b/app/models/project_services/kubernetes_service.rb @@ -100,19 +100,17 @@ class KubernetesService < DeploymentService def predefined_variables config = YAML.dump(kubeconfig) - variables = [ - { key: 'KUBE_URL', value: api_url, public: true }, - { key: 'KUBE_TOKEN', value: token, public: false }, - { key: 'KUBE_NAMESPACE', value: actual_namespace, public: true }, - { key: 'KUBECONFIG', value: config, public: false, file: true } - ] - - if ca_pem.present? - variables << { key: 'KUBE_CA_PEM', value: ca_pem, public: true } - variables << { key: 'KUBE_CA_PEM_FILE', value: ca_pem, public: true, file: true } + variables = Gitlab::Ci::Variables::Collection.new.tap do |collection| + collection.append(key: 'KUBE_URL', value: api_url, public: true) + collection.append(key: 'KUBE_TOKEN', value: token, public: false) + collection.append(key: 'KUBE_NAMESPACE', value: actual_namespace, public: true) + collection.append(key: 'KUBECONFIG', value: config, public: false, file: true) + + collection.append(key: 'KUBE_CA_PEM', value: ca_pem, public: true) + collection.append(key: 'KUBE_CA_PEM_FILE', value: ca_pem, public: true, file: true) end - variables + variables.to_hash end # Constructs a list of terminals from the reactive cache |