Class: DPL::Provider::GAE
Constant Summary
collapse
- BASE =
'https://dl.google.com/dl/cloudsdk/channels/rapid/'
- NAME =
'google-cloud-sdk'
- EXT =
'.tar.gz'
- INSTALL =
'~'
- BOOTSTRAP =
"#{INSTALL}/#{NAME}/bin/bootstrapping/install.py"
- GCLOUD =
"#{INSTALL}/#{NAME}/bin/gcloud"
Instance Attribute Summary
#context, #options
Instance Method Summary
collapse
apt_get, #check_app, #cleanup, #commit_msg, context, #create_key, #deploy, #detect_encoding?, #encoding_for, #error, experimental, #initialize, #log, new, npm_g, #option, pip, requires, #run, #setup_git_credentials, #setup_git_ssh, #sha, shell, #uncleanup, #user_agent, #warn
Constructor Details
This class inherits a constructor from DPL::Provider
Instance Method Details
#check_auth ⇒ Object
35
36
37
38
39
|
# File 'lib/dpl/provider/gae.rb', line 35
def check_auth
unless context.shell("#{GCLOUD} -q --verbosity debug auth activate-service-account --key-file #{keyfile}")
error 'Authentication failed.'
end
end
|
#config ⇒ Object
53
54
55
|
# File 'lib/dpl/provider/gae.rb', line 53
def config
options[:config] || 'app.yaml'
end
|
#docker_build ⇒ Object
65
66
67
|
# File 'lib/dpl/provider/gae.rb', line 65
def docker_build
options[:docker_build] || 'remote'
end
|
#install_deploy_dependencies ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/dpl/provider/gae.rb', line 13
def install_deploy_dependencies
if File.exists? GCLOUD
return
end
$stderr.puts 'Downloading Google Cloud SDK ...'
unless context.shell("curl -L #{BASE + NAME + EXT} | gzip -d | tar -x -C #{INSTALL}")
error 'Could not download Google Cloud SDK.'
end
$stderr.puts 'Bootstrapping Google Cloud SDK ...'
unless context.shell("#{BOOTSTRAP} --usage-reporting=false --command-completion=false --path-update=false")
error 'Could not bootstrap Google Cloud SDK.'
end
end
|
#keyfile ⇒ Object
41
42
43
|
# File 'lib/dpl/provider/gae.rb', line 41
def keyfile
options[:keyfile] || context.env['GOOGLECLOUDKEYFILE'] || 'service-account.json'
end
|
#needs_key? ⇒ Boolean
31
32
33
|
# File 'lib/dpl/provider/gae.rb', line 31
def needs_key?
false
end
|
57
58
59
|
# File 'lib/dpl/provider/gae.rb', line 57
def no_promote
options[:no_promote]
end
|
#no_stop_previous_version ⇒ Object
69
70
71
|
# File 'lib/dpl/provider/gae.rb', line 69
def no_stop_previous_version
options[:no_stop_previous_version]
end
|
#project ⇒ Object
45
46
47
|
# File 'lib/dpl/provider/gae.rb', line 45
def project
options[:project] || context.env['GOOGLECLOUDPROJECT'] || context.env['CLOUDSDK_CORE_PROJECT'] || File.dirname(context.env['TRAVIS_REPO_SLUG'] || '')
end
|
#push_app ⇒ Object
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/dpl/provider/gae.rb', line 73
def push_app
command = GCLOUD
command << ' --quiet'
command << " --verbosity \"#{verbosity}\""
command << " --project \"#{project}\""
command << " preview app deploy \"#{config}\""
command << " --version \"#{version}\""
command << " --docker-build \"#{docker_build}\""
command << " --#{no_promote ? 'no-' : ''}promote"
command << (no_stop_previous_version ? ' --no-stop-previous-version' : '')
unless context.shell(command)
error 'Deployment failed.'
context.shell('find $HOME/.config/gcloud/logs -type f -print -exec cat {} \;')
end
end
|
#verbosity ⇒ Object
61
62
63
|
# File 'lib/dpl/provider/gae.rb', line 61
def verbosity
options[:verbosity] || 'warning'
end
|
#version ⇒ Object
49
50
51
|
# File 'lib/dpl/provider/gae.rb', line 49
def version
options[:version] || ''
end
|