dpl 1.7.22.travis.1047.4 → 1.7.22.travis.1056.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZmZhOTI4NGNmZjFkYmU1NjI5YmY3MzA5NmI5YjhjMmZmZWRmMDFiMQ==
4
+ OWRmNjMxZWMxZTYyMjljY2NiMjQxNzI5ZTY3MTY4NDNkM2VhMjEyMQ==
5
5
  data.tar.gz: !binary |-
6
- MThlNTU1MzM1MDM5YTk0NDgyYzVlNDdkNDkzNzNhZTQzODQ3NjIyNg==
6
+ YWUwOWYyMWMxNGY5NDhjOGNmNmM2NjE1YmJiNjc4Nzc2OWJhZDI1OQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzU4NmZhMmQ3NDY2MWQ1YjcxOGUzY2M5YTlkMTQ1YTRlZWM4ZTBhOGFhNzFm
10
- NGZlYWU2YzU2MjM2ZDUyNzJjMjdkMjQ1ZDA3NmY4MmZiNDdjNDRiYzY1YmQ4
11
- MzZjMjFhOWQ5MmMwN2ExZTc0YTM2ZTIzZTQ5ZDRjYTVjMDU2MmI=
9
+ NzEwYjJkZWJhODQ1YjU4NzI2NTliNmYzZTI4MDdjOGMyZTczMTQ0MDAwNjEx
10
+ N2ZiMzM5MDdjZDdkZTgzNjE1Y2I3ZmEyYTg4MWVjOGMzNjY4Njc3ZTc3YThi
11
+ NTU4YmU0NWVlZmNhMDRkYmVkOWE5MTg2MWU0ODdlY2UzMTMwMmY=
12
12
  data.tar.gz: !binary |-
13
- NWYxMjQzMzNhNjJjYzllMzZjMjZkMThhZTA3ZGQyMzFlYzZmM2MxODkyOGM2
14
- MzA4M2ZjZGQwZWI3NTg3NzFmNGJiYTA5ODNiMGE2OGZiZmMyMWY4YjAzMWYz
15
- NmRjNmVkOTk1MGE3OTNkOTQ3MWEzNGI1MDBiNDk4NGY2MzIzYzY=
13
+ MWVkZmZmYTAzNmY4MmVkNWIxYjhlZWU5MDFjYzk1N2U3MWQxMjBhOTY1N2I3
14
+ ODdhNTk5YjUxNmM1ZmMzNWU1NWI3ZmZhMjM5NzRkOGZiMDBkNzI1NTFjNjMx
15
+ MTkzMjM4MmJhYjE0ZmNmYjJlMTg4ZWQ3NGJjOTU2ZjgyZmIyOGE=
data/Gemfile CHANGED
@@ -53,10 +53,6 @@ group :gcs do
53
53
  gem 'mime-types'
54
54
  end
55
55
 
56
- group :gae do
57
- gem 'rubyzip'
58
- end
59
-
60
56
  group :elastic_beanstalk do
61
57
  gem 'rubyzip'
62
58
  gem 'aws-sdk-v1'
data/README.md CHANGED
@@ -42,6 +42,7 @@ Dpl supports the following providers:
42
42
  * [ExoScale](#exoscale)
43
43
  * [AWS CodeDeploy](#aws-codedeploy)
44
44
  * [Script](#script)
45
+ * [Google App Engine (experimental)](#google-app-engine)
45
46
 
46
47
  ## Installation:
47
48
 
@@ -719,3 +720,27 @@ Deployment will be marked a failure if the script exits with nonzero status.
719
720
  #### Example:
720
721
 
721
722
  dpl --provider=script --script=./script/deploy.sh
723
+
724
+ ### Google App Engine:
725
+
726
+ Deploys to Google App Engine and Google App Engine Managed VMs via the Google Cloud SDK and
727
+ it's [`gcloud` tool](https://cloud.google.com/sdk/gcloud/) using a [Service Account](https://developers.google.com/console/help/new/#serviceaccounts).
728
+
729
+ #### Options:
730
+
731
+ * **project**: [Project ID](https://developers.google.com/console/help/new/#projectnumber) used to identify the project on Google Cloud.
732
+ * **keyfile**: Path to the JSON file containing your [Service Account](https://developers.google.com/console/help/new/#serviceaccounts) credentials in [JSON Web Token](https://tools.ietf.org/html/rfc7519) format. To be obtained via the [Google Developers Console](https://console.developers.google.com/project/_/apiui/credential). Defaults to `"service-account.json"`. Note that this file should be handled with care as it contains authorization keys.
733
+ * **config**: Path to your module configuration file. Defaults to `"app.yaml"`. This file is runtime dependent ([Go](https://cloud.google.com/appengine/docs/go/config/appconfig), [Java](https://cloud.google.com/appengine/docs/java/configyaml/appconfig_yaml), [PHP](https://developers.google.com/console/help/new/#projectnumber), [Python](https://cloud.google.com/appengine/docs/python/config/appconfig))
734
+ * **version**: The version of the app that will be created or replaced by this deployment. If you do not specify a version, one will be generated for you. See [`gcloud preview app deploy`](https://cloud.google.com/sdk/gcloud/reference/preview/app/deploy)
735
+ * **default**: Flag to set the deployed version to be the default serving version. See [`gcloud preview app deploy`](https://cloud.google.com/sdk/gcloud/reference/preview/app/deploy)
736
+ * **verbosity**: Let's you adjust the verbosity when invoking `"gcloud"`. Defaults to `"warning"`. See [`gcloud`](https://cloud.google.com/sdk/gcloud/reference/).
737
+ * **docker_build**: If deploying a Managed VM, specifies where to build your image. Typical values are `"remote"` to build on Google Cloud Engine and `"local"` which requires Docker to be set up properly (to utilize this on Travis CI, read [Using Docker on Travis CI](http://blog.travis-ci.com/2015-08-19-using-docker-on-travis-ci/)). Defaults to `"remote"`.
738
+
739
+ #### Environment variables:
740
+
741
+ * **GOOGLECLOUDPROJECT** or **CLOUDSDK_CORE_PROJECT**: Can be used instead of the `project` option.
742
+ * **GOOGLECLOUDKEYFILE**: Can be used instead of the `keyfile` option.
743
+
744
+ #### Example:
745
+
746
+ dpl --provider=gae --project=example --default=true
@@ -1,69 +1,91 @@
1
- require 'digest/sha1'
2
- require 'open-uri'
3
-
4
1
  module DPL
5
2
  class Provider
6
3
  class GAE < Provider
7
4
  experimental 'Google App Engine'
8
5
 
9
- # https://developers.google.com/appengine/downloads
10
- GAE_VERSION='1.9.17'
11
- GAE_ZIP_FILE="google_appengine_#{GAE_VERSION}.zip"
12
- SHA1SUM='eec50aaf922d3b21623fda1b90e199c3ffa9e16e'
13
- BASE_DIR=Dir.pwd
14
- GAE_DIR=File.join(BASE_DIR, 'google_appengine')
15
- APPCFG_BIN=File.join(GAE_DIR, 'appcfg.py')
16
-
17
- def self.install_sdk
18
- requires 'rubyzip', :load => 'zip'
19
- $stderr.puts "Setting up Google App Engine SDK"
20
-
21
- Dir.chdir(BASE_DIR) do
22
- unless File.exists? GAE_ZIP_FILE
23
- $stderr.puts "Downloading Google App Engine SDK"
24
- File.open(GAE_ZIP_FILE, "wb") do |dest|
25
- open("https://storage.googleapis.com/appengine-sdks/featured/#{GAE_ZIP_FILE}", "rb") do |src|
26
- dest.write(src.read)
27
- end
28
- end
29
- end
30
- sha1sum = Digest::SHA1.hexdigest(File.read(GAE_ZIP_FILE))
31
- unless sha1sum == SHA1SUM
32
- raise "Checksum did not match for #{GAE_ZIP_FILE}"
33
- end
6
+ BASE='https://dl.google.com/dl/cloudsdk/channels/rapid/'
7
+ NAME='google-cloud-sdk'
8
+ EXT='.tar.gz'
9
+ INSTALL='~'
10
+ BOOTSTRAP="#{INSTALL}/#{NAME}/bin/bootstrapping/install.py"
11
+ GCLOUD="#{INSTALL}/#{NAME}/bin/gcloud"
34
12
 
35
- unless File.directory? 'google_appengine'
36
- $stderr.puts "Extracting Google App Engine SDK archive"
37
- Zip::File.open(GAE_ZIP_FILE) do |file|
38
- file.each do |entry|
39
- entry.extract entry.name
40
- end
41
- end
13
+ def install_deploy_dependencies
14
+ # FIXME this is a workaround for https://code.google.com/p/google-cloud-sdk/issues/detail?id=228
15
+ if docker_build == "remote" && !File.exists?("#{Dir.home}/.ssh/google_compute_engine")
16
+ unless context.shell('ssh-keygen -f ~/.ssh/google_compute_engine -t rsa -N \'\'')
17
+ error 'Failed to generate SSH key for remote Docker build.'
42
18
  end
43
19
  end
44
- end
45
20
 
46
- install_sdk
21
+ if File.exists? GCLOUD
22
+ return
23
+ end
24
+
25
+ $stderr.puts 'Downloading Google Cloud SDK ...'
26
+
27
+ unless context.shell("curl -L #{BASE + NAME + EXT} | gzip -d | tar -x -C #{INSTALL}")
28
+ error 'Could not download Google Cloud SDK.'
29
+ end
30
+
31
+ $stderr.puts 'Bootstrapping Google Cloud SDK ...'
32
+
33
+ unless context.shell("#{BOOTSTRAP} --usage-reporting=false --command-completion=false --path-update=false --additional-components=preview")
34
+ error 'Could not bootstrap Google Cloud SDK.'
35
+ end
36
+ end
47
37
 
48
38
  def needs_key?
49
39
  false
50
40
  end
51
41
 
52
42
  def check_auth
43
+ unless context.shell("#{GCLOUD} -q --verbosity debug auth activate-service-account --key-file #{keyfile}")
44
+ error 'Authentication failed.'
45
+ end
46
+ end
47
+
48
+ def keyfile
49
+ options[:keyfile] || context.env['GOOGLECLOUDKEYFILE'] || 'service-account.json'
50
+ end
51
+
52
+ def project
53
+ options[:project] || context.env['GOOGLECLOUDPROJECT'] || context.env['CLOUDSDK_CORE_PROJECT'] || File.dirname(context.env['TRAVIS_REPO_SLUG'] || '')
54
+ end
55
+
56
+ def version
57
+ options[:version] || ''
58
+ end
59
+
60
+ def config
61
+ options[:config] || 'app.yaml'
62
+ end
63
+
64
+ def default
65
+ options[:default]
66
+ end
67
+
68
+ def verbosity
69
+ options[:verbosity] || 'warning'
53
70
  end
54
71
 
55
- def app_dir
56
- options[:app_dir] || context.env['TRAVIS_BUILD_DIR'] || Dir.pwd
72
+ def docker_build
73
+ options[:docker_build] || 'remote'
57
74
  end
58
75
 
59
76
  def push_app
60
- puts "About to call push_app in with #{self.class} provider"
61
- puts "APPCFG_BIN: #{APPCFG_BIN}"
62
- unless File.exist?(APPCFG_BIN)
63
- puts "APPCFG_BIN does not exist"
77
+ command = GCLOUD
78
+ command << ' --quiet'
79
+ command << " --verbosity \"#{verbosity}\""
80
+ command << " --project \"#{project}\""
81
+ command << " preview app deploy \"#{config}\""
82
+ command << " --version \"#{version}\""
83
+ command << " --docker-build \"#{docker_build}\""
84
+ command << (default ? ' --set-default' : '')
85
+ unless context.shell(command)
86
+ error 'Deployment failed.'
64
87
  end
65
- context.shell "#{APPCFG_BIN} --oauth2_refresh_token=#{options[:oauth_refresh_token]} update #{app_dir}"
66
88
  end
67
89
  end
68
90
  end
69
- end
91
+ end
@@ -1,26 +1,15 @@
1
- # require 'spec_helper'
2
- # require 'dpl/provider/gae'
3
- #
4
- # describe DPL::Provider::GAE do
5
- # subject :provider do
6
- # described_class.new(DummyContext.new, :user => 'foo', :password => 'bar')
7
- # end
8
- #
9
- # let(:token) { 'deadbeef012345' }
10
- #
11
- # describe '#push_app' do
12
- # example 'with default app_dir' do
13
- # provider.context.env['TRAVIS_BUILD_DIR'] = Dir.pwd
14
- # provider.options.update(:oauth_refresh_token => token)
15
- # expect(provider.context).to receive(:shell).with("#{DPL::Provider::GAE::APPCFG_BIN} --oauth2_refresh_token=#{token} update #{Dir.pwd}").and_return(true)
16
- # provider.push_app
17
- # end
18
- #
19
- # example 'with custom app_dir' do
20
- # app_dir='foo'
21
- # provider.options.update(:oauth_refresh_token => token, :app_dir => app_dir)
22
- # expect(provider.context).to receive(:shell).with("#{DPL::Provider::GAE::APPCFG_BIN} --oauth2_refresh_token=#{token} update #{app_dir}").and_return(true)
23
- # provider.push_app
24
- # end
25
- # end
26
- # end
1
+ require 'spec_helper'
2
+ require 'dpl/provider/gae'
3
+
4
+ describe DPL::Provider::GAE do
5
+ subject :provider do
6
+ described_class.new(DummyContext.new, project: 'test')
7
+ end
8
+
9
+ describe '#push_app' do
10
+ example 'with defaults' do
11
+ expect(provider.context).to receive(:shell).with("#{DPL::Provider::GAE::GCLOUD} --quiet --verbosity \"warning\" --project \"test\" preview app deploy \"app.yaml\" --version \"\" --docker-build \"remote\"").and_return(true)
12
+ provider.push_app
13
+ end
14
+ end
15
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dpl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.22.travis.1047.4
4
+ version: 1.7.22.travis.1056.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-01 00:00:00.000000000 Z
11
+ date: 2015-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec