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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
1dca45ff
Commit
1dca45ff
authored
Jun 11, 2018
by
Dylan Griffith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move ENV variables to Runtime::Env for auto devops QA
parent
d2c4b747
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
9 deletions
+17
-9
qa/qa/runtime/env.rb
qa/qa/runtime/env.rb
+12
-0
qa/qa/service/kubernetes_cluster.rb
qa/qa/service/kubernetes_cluster.rb
+5
-9
No files found.
qa/qa/runtime/env.rb
View file @
1dca45ff
...
@@ -46,6 +46,18 @@ module QA
...
@@ -46,6 +46,18 @@ module QA
def
sandbox_name
def
sandbox_name
ENV
[
'GITLAB_SANDBOX_NAME'
]
ENV
[
'GITLAB_SANDBOX_NAME'
]
end
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
end
end
end
qa/qa/service/kubernetes_cluster.rb
View file @
1dca45ff
...
@@ -20,10 +20,10 @@ module QA
...
@@ -20,10 +20,10 @@ module QA
gcloud container clusters
gcloud container clusters
create
#{
cluster_name
}
create
#{
cluster_name
}
--enable-legacy-authorization
--enable-legacy-authorization
--zone
#{
gcloud_zone
}
--zone
#{
Runtime
::
Env
.
gcloud_zone
}
&& gcloud container clusters
&& gcloud container clusters
get-credentials
get-credentials
--zone
#{
gcloud_zone
}
--zone
#{
Runtime
::
Env
.
gcloud_zone
}
#{
cluster_name
}
#{
cluster_name
}
CMD
CMD
...
@@ -36,7 +36,7 @@ module QA
...
@@ -36,7 +36,7 @@ module QA
def
remove!
def
remove!
shell
<<~
CMD
.
tr
(
"
\n
"
,
' '
)
shell
<<~
CMD
.
tr
(
"
\n
"
,
' '
)
gcloud container clusters delete
gcloud container clusters delete
--zone
#{
gcloud_zone
}
--zone
#{
Runtime
::
Env
.
gcloud_zone
}
#{
cluster_name
}
#{
cluster_name
}
--quiet --async
--quiet --async
CMD
CMD
...
@@ -61,17 +61,13 @@ module QA
...
@@ -61,17 +61,13 @@ module QA
def
attempt_login_with_env_vars
def
attempt_login_with_env_vars
puts
"No gcloud account. Attempting to login from env vars GCLOUD_ACCOUNT_EMAIL and GCLOUD_ACCOUNT_KEY."
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
=
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_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
}
"
)
shell
(
"gcloud auth activate-service-account
#{
gcloud_account_email
}
--key-file
#{
gcloud_account_key
.
path
}
"
)
ensure
ensure
gcloud_account_key
&&
gcloud_account_key
.
unlink
gcloud_account_key
&&
gcloud_account_key
.
unlink
end
end
def
gcloud_zone
ENV
.
fetch
(
'GCLOUD_ZONE'
)
end
end
end
end
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