summaryrefslogtreecommitdiff
path: root/qa/qa/service/kubernetes_cluster.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/service/kubernetes_cluster.rb')
-rw-r--r--qa/qa/service/kubernetes_cluster.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/qa/qa/service/kubernetes_cluster.rb b/qa/qa/service/kubernetes_cluster.rb
index 7627c8c7ad9..abd9d53554f 100644
--- a/qa/qa/service/kubernetes_cluster.rb
+++ b/qa/qa/service/kubernetes_cluster.rb
@@ -50,11 +50,15 @@ module QA
end
def login_if_not_already_logged_in
- account = `gcloud auth list --filter=status:ACTIVE --format="value(account)"`
- if account.empty?
+ if Runtime::Env.has_gcloud_credentials?
attempt_login_with_env_vars
else
- puts "gcloud account found. Using: #{account} for creating K8s cluster."
+ account = `gcloud auth list --filter=status:ACTIVE --format="value(account)"`
+ if account.empty?
+ raise "Failed to login to gcloud. No credentials provided in environment and no credentials found locally."
+ else
+ puts "gcloud account found. Using: #{account} for creating K8s cluster."
+ end
end
end