summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorDylan Griffith <dyl.griffith@gmail.com>2018-06-11 11:31:33 +0200
committerDylan Griffith <dyl.griffith@gmail.com>2018-06-11 11:31:33 +0200
commit1dca45ff9670d0bd7cc0b2f3cbe23a8b4a809453 (patch)
treefdf700357907c5e72435bcfff39903078350e543 /qa
parentd2c4b7471f3441ddd7da282f9826b80ae7a22379 (diff)
downloadgitlab-ce-1dca45ff9670d0bd7cc0b2f3cbe23a8b4a809453.tar.gz
Move ENV variables to Runtime::Env for auto devops QAqa-112-fix-auto-devops-cluster-spec
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/runtime/env.rb12
-rw-r--r--qa/qa/service/kubernetes_cluster.rb14
2 files changed, 17 insertions, 9 deletions
diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb
index fe432edfa2a..81d00d45753 100644
--- a/qa/qa/runtime/env.rb
+++ b/qa/qa/runtime/env.rb
@@ -46,6 +46,18 @@ module QA
def sandbox_name
ENV['GITLAB_SANDBOX_NAME']
end
+
+ def gcloud_account_key
+ ENV.fetch("GCLOUD_ACCOUNT_KEY")
+ end
+
+ def gcloud_account_email
+ ENV.fetch("GCLOUD_ACCOUNT_EMAIL")
+ end
+
+ def gcloud_zone
+ ENV.fetch('GCLOUD_ZONE')
+ end
end
end
end
diff --git a/qa/qa/service/kubernetes_cluster.rb b/qa/qa/service/kubernetes_cluster.rb
index 71dcad7ed57..7627c8c7ad9 100644
--- a/qa/qa/service/kubernetes_cluster.rb
+++ b/qa/qa/service/kubernetes_cluster.rb
@@ -20,10 +20,10 @@ module QA
gcloud container clusters
create #{cluster_name}
--enable-legacy-authorization
- --zone #{gcloud_zone}
+ --zone #{Runtime::Env.gcloud_zone}
&& gcloud container clusters
get-credentials
- --zone #{gcloud_zone}
+ --zone #{Runtime::Env.gcloud_zone}
#{cluster_name}
CMD
@@ -36,7 +36,7 @@ module QA
def remove!
shell <<~CMD.tr("\n", ' ')
gcloud container clusters delete
- --zone #{gcloud_zone}
+ --zone #{Runtime::Env.gcloud_zone}
#{cluster_name}
--quiet --async
CMD
@@ -61,17 +61,13 @@ module QA
def attempt_login_with_env_vars
puts "No gcloud account. Attempting to login from env vars GCLOUD_ACCOUNT_EMAIL and GCLOUD_ACCOUNT_KEY."
gcloud_account_key = Tempfile.new('gcloud-account-key')
- gcloud_account_key.write(ENV.fetch("GCLOUD_ACCOUNT_KEY"))
+ gcloud_account_key.write(Runtime::Env.gcloud_account_key)
gcloud_account_key.close
- gcloud_account_email = ENV.fetch("GCLOUD_ACCOUNT_EMAIL")
+ gcloud_account_email = Runtime::Env.gcloud_account_email
shell("gcloud auth activate-service-account #{gcloud_account_email} --key-file #{gcloud_account_key.path}")
ensure
gcloud_account_key && gcloud_account_key.unlink
end
-
- def gcloud_zone
- ENV.fetch('GCLOUD_ZONE')
- end
end
end
end