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
Hide 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,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
...
...
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