Skip to content
Snippets Groups Projects
Commit 9a4eadc8 authored by Grzegorz Bizon's avatar Grzegorz Bizon
Browse files

Merge branch 'qa-112-fix-auto-devops-cluster-spec' into 'master'

Qa 112 fix auto devops cluster spec

See merge request gitlab-org/gitlab-ce!19584
parents 9556030d 1dca45ff
No related branches found
No related tags found
1 merge request!10495Merge Requests - Assignee
require 'pathname'
module QA
module Factory
module Repository
Loading
Loading
Loading
Loading
@@ -46,6 +46,18 @@ module QA
def sandbox_name
ENV['GITLAB_SANDBOX_NAME']
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
Loading
Loading
@@ -20,9 +20,11 @@ module QA
gcloud container clusters
create #{cluster_name}
--enable-legacy-authorization
--zone us-central1-a
--zone #{Runtime::Env.gcloud_zone}
&& gcloud container clusters
get-credentials #{cluster_name}
get-credentials
--zone #{Runtime::Env.gcloud_zone}
#{cluster_name}
CMD
 
@api_url = `kubectl config view --minify -o jsonpath='{.clusters[].cluster.server}'`
Loading
Loading
@@ -32,7 +34,12 @@ module QA
end
 
def remove!
shell("gcloud container clusters delete #{cluster_name} --quiet --async")
shell <<~CMD.tr("\n", ' ')
gcloud container clusters delete
--zone #{Runtime::Env.gcloud_zone}
#{cluster_name}
--quiet --async
CMD
end
 
private
Loading
Loading
@@ -54,9 +61,9 @@ module QA
def attempt_login_with_env_vars
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.write(ENV.fetch("GCLOUD_ACCOUNT_KEY"))
gcloud_account_key.write(Runtime::Env.gcloud_account_key)
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}")
ensure
gcloud_account_key && gcloud_account_key.unlink
Loading
Loading
require 'pathname'
module QA
feature 'Auto Devops', :kubernetes do
after do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment