appengine 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/appengine/exec.rb +45 -6
- data/lib/appengine/tasks.rb +13 -1
- data/lib/appengine/version.rb +1 -1
- metadata +18 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8985bf9ca824b3567577328e9c844eabcab5691907b0eb8a3385c181c91d2f13
|
4
|
+
data.tar.gz: 04d8e4d73ee85d186798b69748191ec14423aecabfa1cbc5446d6e79e29b438c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa651f55f75abf3d21813891a34c26d9c27ffe0656f7b77e54f440a2bb8d747f751317327cdc250a72fc3e286e4a76b79ac4f44ace1f70f01d8d46d3a27866ec
|
7
|
+
data.tar.gz: a03743e4a99da424fb1c588f83767389c36b82ddcb5271cba0462a5c7433bd113d3db1b668159dad5520eaa7fcb11ffcb88694133a0f46feb557ac69ada0bab2
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
This is the change history for the appengine gem.
|
4
4
|
|
5
|
+
## v0.6.0 (2020-12-02)
|
6
|
+
|
7
|
+
* Fix failure in the appengine:exec cloud_build strategy when App Engine doesn't provide the image
|
8
|
+
* Fix exception when appengine:exec is provided a shell command rather than a command array (tpbowden)
|
9
|
+
* Update stackdriver dependency to 0.20 and google-cloud-env dependency to 1.4
|
10
|
+
|
5
11
|
## v0.5.0 (2019-07-15)
|
6
12
|
|
7
13
|
* appengine:exec supports the App Engine standard environment.
|
data/lib/appengine/exec.rb
CHANGED
@@ -15,6 +15,7 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
|
18
|
+
require "date"
|
18
19
|
require "erb"
|
19
20
|
require "json"
|
20
21
|
require "net/http"
|
@@ -175,6 +176,11 @@ module AppEngine
|
|
175
176
|
# accessed only over a private IP, you should use the `deployment` strategy
|
176
177
|
# instead.
|
177
178
|
#
|
179
|
+
# The Cloud Build log is output to the directory specified by
|
180
|
+
# "CLOUD_BUILD_GCS_LOG_DIR". (ex. "gs://BUCKET-NAME/FOLDER-NAME")
|
181
|
+
# By default, log directory name is
|
182
|
+
# "gs://[PROJECT_NUMBER].cloudbuild-logs.googleusercontent.com/".
|
183
|
+
#
|
178
184
|
# ### Specifying the host application
|
179
185
|
#
|
180
186
|
# The `cloud_build` strategy needs to know exactly which app, service, and
|
@@ -365,11 +371,13 @@ module AppEngine
|
|
365
371
|
# standard). Allowed values are `nil`, `"deployment"` (which is the
|
366
372
|
# default for Standard), and `"cloud_build"` (which is the default
|
367
373
|
# for Flexible).
|
374
|
+
# @param gcs_log_dir [String,nil] GCS bucket name of the cloud build log
|
375
|
+
# when strategy is "cloud_build". (ex. "gs://BUCKET-NAME/FOLDER-NAME")
|
368
376
|
#
|
369
377
|
def new_rake_task name, args: [], env_args: [],
|
370
378
|
service: nil, config_path: nil, version: nil,
|
371
379
|
timeout: nil, project: nil, wrapper_image: nil,
|
372
|
-
strategy: nil
|
380
|
+
strategy: nil, gcs_log_dir: nil
|
373
381
|
escaped_args = args.map do |arg|
|
374
382
|
arg.gsub(/[,\[\]]/) { |m| "\\#{m}" }
|
375
383
|
end
|
@@ -382,7 +390,7 @@ module AppEngine
|
|
382
390
|
new ["bundle", "exec", "rake", name_with_args] + env_args,
|
383
391
|
service: service, config_path: config_path, version: version,
|
384
392
|
timeout: timeout, project: project, wrapper_image: wrapper_image,
|
385
|
-
strategy: strategy
|
393
|
+
strategy: strategy, gcs_log_dir: gcs_log_dir
|
386
394
|
end
|
387
395
|
end
|
388
396
|
|
@@ -410,10 +418,12 @@ module AppEngine
|
|
410
418
|
# standard). Allowed values are `nil`, `"deployment"` (which is the
|
411
419
|
# default for Standard), and `"cloud_build"` (which is the default for
|
412
420
|
# Flexible).
|
421
|
+
# @param gcs_log_dir [String,nil] GCS bucket name of the cloud build log
|
422
|
+
# when strategy is "cloud_build". (ex. "gs://BUCKET-NAME/FOLDER-NAME")
|
413
423
|
#
|
414
424
|
def initialize command,
|
415
425
|
project: nil, service: nil, config_path: nil, version: nil,
|
416
|
-
timeout: nil, wrapper_image: nil, strategy: nil
|
426
|
+
timeout: nil, wrapper_image: nil, strategy: nil, gcs_log_dir: nil
|
417
427
|
@command = command
|
418
428
|
@service = service
|
419
429
|
@config_path = config_path
|
@@ -422,6 +432,7 @@ module AppEngine
|
|
422
432
|
@project = project
|
423
433
|
@wrapper_image = wrapper_image
|
424
434
|
@strategy = strategy
|
435
|
+
@gcs_log_dir = gcs_log_dir
|
425
436
|
|
426
437
|
yield self if block_given?
|
427
438
|
end
|
@@ -502,7 +513,7 @@ module AppEngine
|
|
502
513
|
#
|
503
514
|
def resolve_parameters
|
504
515
|
@timestamp_suffix = ::Time.now.strftime "%Y%m%d%H%M%S"
|
505
|
-
@command = ::Shellwords.
|
516
|
+
@command = ::Shellwords.split @command.to_s unless @command.is_a? Array
|
506
517
|
@project ||= default_project
|
507
518
|
@service ||= service_from_config || Exec.default_service
|
508
519
|
@version ||= latest_version @service
|
@@ -751,7 +762,8 @@ module AppEngine
|
|
751
762
|
env_variables = app_info["envVariables"] || {}
|
752
763
|
beta_settings = app_info["betaSettings"] || {}
|
753
764
|
cloud_sql_instances = beta_settings["cloud_sql_instances"] || []
|
754
|
-
|
765
|
+
container = app_info["deployment"]["container"]
|
766
|
+
image = container ? container["image"] : image_from_build(app_info)
|
755
767
|
|
756
768
|
describe_build_strategy
|
757
769
|
|
@@ -760,18 +772,45 @@ module AppEngine
|
|
760
772
|
begin
|
761
773
|
::JSON.dump config, file
|
762
774
|
file.flush
|
763
|
-
|
775
|
+
execute_command = [
|
764
776
|
"builds", "submit",
|
765
777
|
"--project", @project,
|
766
778
|
"--no-source",
|
767
779
|
"--config", file.path,
|
768
780
|
"--timeout", @timeout
|
769
781
|
]
|
782
|
+
execute_command.concat ["--gcs-log-dir", @gcs_log_dir] unless @gcs_log_dir.nil?
|
783
|
+
Util::Gcloud.execute execute_command
|
770
784
|
ensure
|
771
785
|
file.close!
|
772
786
|
end
|
773
787
|
end
|
774
788
|
|
789
|
+
##
|
790
|
+
# @private
|
791
|
+
# Workaround for https://github.com/GoogleCloudPlatform/appengine-ruby/issues/33
|
792
|
+
# Determines the image by looking it up in Cloud Build
|
793
|
+
#
|
794
|
+
def image_from_build app_info
|
795
|
+
create_time = ::DateTime.parse(app_info["createTime"]).to_time.utc
|
796
|
+
after_time = (create_time - 3600).strftime "%Y-%m-%dT%H:%M:%SZ"
|
797
|
+
before_time = (create_time + 3600).strftime "%Y-%m-%dT%H:%M:%SZ"
|
798
|
+
partial_uri = "gcr.io/#{@project}/appengine/#{@service}.#{@version}"
|
799
|
+
filter = "createTime>#{after_time} createTime<#{before_time} images[]:#{partial_uri}"
|
800
|
+
result = Util::Gcloud.execute \
|
801
|
+
[
|
802
|
+
"builds", "list",
|
803
|
+
"--project", @project,
|
804
|
+
"--filter", filter,
|
805
|
+
"--format", "json"
|
806
|
+
],
|
807
|
+
capture: true, assert: false
|
808
|
+
result.strip!
|
809
|
+
raise NoSuchVersion.new(@service, @version) if result.empty?
|
810
|
+
build_info = ::JSON.parse(result).first
|
811
|
+
build_info["images"].first
|
812
|
+
end
|
813
|
+
|
775
814
|
def describe_build_strategy
|
776
815
|
puts "\nUsing the `cloud_build` strategy for appengine:exec"
|
777
816
|
puts "(i.e. running your app image in Cloud Build)"
|
data/lib/appengine/tasks.rb
CHANGED
@@ -113,6 +113,10 @@ module AppEngine
|
|
113
113
|
# the "cloud_build" strategy, and applies only to that strategy.) Normally,
|
114
114
|
# you should not override this unless you are testing a new wrapper.
|
115
115
|
#
|
116
|
+
# #### CLOUD_BUILD_GCS_LOG_DIR
|
117
|
+
#
|
118
|
+
# GCS bucket name of the cloud build log when GAE_STRATEGY is "cloud_build".
|
119
|
+
# (ex. "gs://BUCKET-NAME/FOLDER-NAME")
|
116
120
|
module Tasks
|
117
121
|
## @private
|
118
122
|
PROJECT_ENV = "GAE_PROJECT"
|
@@ -128,6 +132,8 @@ module AppEngine
|
|
128
132
|
TIMEOUT_ENV = "GAE_TIMEOUT"
|
129
133
|
## @private
|
130
134
|
WRAPPER_IMAGE_ENV = "GAE_EXEC_WRAPPER_IMAGE"
|
135
|
+
## @private
|
136
|
+
GCS_LOG_DIR = "CLOUD_BUILD_GCS_LOG_DIR"
|
131
137
|
|
132
138
|
@defined = false
|
133
139
|
|
@@ -161,7 +167,8 @@ module AppEngine
|
|
161
167
|
version: ::ENV[VERSION_ENV],
|
162
168
|
timeout: ::ENV[TIMEOUT_ENV],
|
163
169
|
wrapper_image: ::ENV[WRAPPER_IMAGE_ENV],
|
164
|
-
strategy: ::ENV[STRATEGY_ENV]
|
170
|
+
strategy: ::ENV[STRATEGY_ENV],
|
171
|
+
gcs_log_dir: ::ENV[GCS_LOG_DIR]
|
165
172
|
start_and_report_errors app_exec
|
166
173
|
exit
|
167
174
|
end
|
@@ -274,6 +281,11 @@ module AppEngine
|
|
274
281
|
the "cloud_build" strategy, and applies only to that strategy.) Normally,
|
275
282
|
you should not override this unless you are testing a new wrapper.
|
276
283
|
|
284
|
+
CLOUD_BUILD_GCS_LOG_DIR
|
285
|
+
|
286
|
+
GCS bucket name of the cloud build log when GAE_STRATEGY is "cloud_build".
|
287
|
+
(ex. "gs://BUCKET-NAME/FOLDER-NAME")
|
288
|
+
|
277
289
|
This rake task is provided by the "appengine" gem. To make these tasks
|
278
290
|
available, add the following line to your Rakefile:
|
279
291
|
|
data/lib/appengine/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appengine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Azuma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-cloud-env
|
@@ -16,28 +16,34 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: stackdriver
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.20'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 0.20.1
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
41
|
- - "~>"
|
39
42
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
43
|
+
version: '0.20'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.20.1
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: bundler
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +64,14 @@ dependencies:
|
|
58
64
|
requirements:
|
59
65
|
- - "~>"
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
67
|
+
version: 1.24.0
|
62
68
|
type: :development
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
72
|
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
74
|
+
version: 1.24.0
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
76
|
name: minitest
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,34 +156,20 @@ dependencies:
|
|
150
156
|
- - "~>"
|
151
157
|
- !ruby/object:Gem::Version
|
152
158
|
version: '3.4'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: rubocop
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - "~>"
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: 0.64.0
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - "~>"
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: 0.64.0
|
167
159
|
- !ruby/object:Gem::Dependency
|
168
160
|
name: toys
|
169
161
|
requirement: !ruby/object:Gem::Requirement
|
170
162
|
requirements:
|
171
163
|
- - "~>"
|
172
164
|
- !ruby/object:Gem::Version
|
173
|
-
version: '0.
|
165
|
+
version: '0.11'
|
174
166
|
type: :development
|
175
167
|
prerelease: false
|
176
168
|
version_requirements: !ruby/object:Gem::Requirement
|
177
169
|
requirements:
|
178
170
|
- - "~>"
|
179
171
|
- !ruby/object:Gem::Version
|
180
|
-
version: '0.
|
172
|
+
version: '0.11'
|
181
173
|
- !ruby/object:Gem::Dependency
|
182
174
|
name: yard
|
183
175
|
requirement: !ruby/object:Gem::Requirement
|
@@ -229,15 +221,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
229
221
|
requirements:
|
230
222
|
- - ">="
|
231
223
|
- !ruby/object:Gem::Version
|
232
|
-
version: 2.
|
224
|
+
version: 2.4.0
|
233
225
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
234
226
|
requirements:
|
235
227
|
- - ">="
|
236
228
|
- !ruby/object:Gem::Version
|
237
229
|
version: '0'
|
238
230
|
requirements: []
|
239
|
-
|
240
|
-
rubygems_version: 2.7.6.2
|
231
|
+
rubygems_version: 3.0.3
|
241
232
|
signing_key:
|
242
233
|
specification_version: 4
|
243
234
|
summary: Google App Engine integration tools
|