Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
2a8d0b59
Commit
2a8d0b59
authored
Jul 03, 2018
by
Dylan Griffith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Auto DevOps QA: Prefer gcloud credentials from env
parent
00518d26
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
qa/qa/runtime/env.rb
qa/qa/runtime/env.rb
+4
-0
qa/qa/service/kubernetes_cluster.rb
qa/qa/service/kubernetes_cluster.rb
+7
-3
No files found.
qa/qa/runtime/env.rb
View file @
2a8d0b59
...
...
@@ -58,6 +58,10 @@ module QA
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,13 +50,17 @@ module QA
end
def
login_if_not_already_logged_in
if
Runtime
::
Env
.
has_gcloud_credentials?
attempt_login_with_env_vars
else
account
=
`gcloud auth list --filter=status:ACTIVE --format="value(account)"`
if
account
.
empty?
attempt_login_with_env_vars
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
def
attempt_login_with_env_vars
puts
"No gcloud account. Attempting to login from env vars GCLOUD_ACCOUNT_EMAIL and GCLOUD_ACCOUNT_KEY."
...
...
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