Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Privacy
Imprint
Contact
Login methods
Sign in
Toggle navigation
Menu
Open sidebar
projects.thm.de
GitLab
Commits
2a8d0b59
Commit
2a8d0b59
authored
Jul 03, 2018
by
Dylan Griffith
Browse files
Auto DevOps QA: Prefer gcloud credentials from env
parent
00518d26
Changes
2
Hide whitespace changes
Inline
Side-by-side
qa/qa/runtime/env.rb
View file @
2a8d0b59
...
...
@@ -58,6 +58,10 @@ def gcloud_account_email
def
gcloud_zone
ENV
.
fetch
(
'GCLOUD_ZONE'
)
end
def
has_gcloud_credentials?
%w[GCLOUD_ACCOUNT_KEY GCLOUD_ACCOUNT_EMAIL]
.
none?
{
|
var
|
ENV
[
var
].
to_s
.
empty?
}
end
end
end
end
qa/qa/service/kubernetes_cluster.rb
View file @
2a8d0b59
...
...
@@ -50,11 +50,15 @@ def validate_dependencies
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment