functions_framework 1.0.1 → 1.1.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 +7 -0
- data/RELEASING.md +78 -0
- data/lib/functions_framework/server.rb +22 -7
- data/lib/functions_framework/testing.rb +2 -1
- data/lib/functions_framework/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7181bfabab004b16d032f16f2598fb80027422481c9ce5ee3c048f5331422d10
|
4
|
+
data.tar.gz: 73344235c945308d98a44bb7536bbc32d6fdb5b58ed0379696a09becdf2be016
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4edeb7e9b2fbd5ab9ee3d28f442336363c32ab2faf928b81738b5c82a3c6b16b8e9dd0983417427db4145930eaf12b1f0d709e638999edba01c55c3b5cbdcf97
|
7
|
+
data.tar.gz: ffe0f772f40ff8d8c1a74e8cf6f2e5adfa663513290f88b4c9ad119dfb91b7b0caa3887337bad1736eb556b8d5312b376606b266602069db32fd75973867fa06
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.1.0 (2022-01-17)
|
4
|
+
|
5
|
+
* Increase default max thread pool size to 8.
|
6
|
+
* Return 204 when a GET request is sent to an event function, to support health checks.
|
7
|
+
* Flush stdout and stderr streams at the end of each request.
|
8
|
+
* Format the error backtrace.
|
9
|
+
|
3
10
|
## 1.0.1 (2021-09-10)
|
4
11
|
|
5
12
|
* FIXED: Update legacy event conversion to set the correct types for firebase database events
|
data/RELEASING.md
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# Releasing
|
2
|
+
|
3
|
+
Releases are performed using tooling developed by Google's GitHub Automation
|
4
|
+
team, and are partially automated, but can be controlled by maintainers.
|
5
|
+
|
6
|
+
## The automated release pipeline
|
7
|
+
|
8
|
+
Whenever a commit is pushed to the main branch with a
|
9
|
+
[Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) message,
|
10
|
+
the automated release pipeline will trigger.
|
11
|
+
|
12
|
+
### Release pull requests
|
13
|
+
|
14
|
+
The [release-please](https://github.com/googleapis/release-please) bot watches
|
15
|
+
for commits that indicate a semantic change, normally either `feat:` or `fix:`,
|
16
|
+
or any commit that includes a breaking change. When new commits are pushed,
|
17
|
+
release-please will propose a new release whose version is based on the semver
|
18
|
+
implication of the change: a patch release for a `fix:`, a minor release for a
|
19
|
+
`feat:`, or a major release for a breaking change. This will appear in the form
|
20
|
+
of a pull request, which will include the proposed new version, and a changelog
|
21
|
+
entry.
|
22
|
+
|
23
|
+
A maintainer can either:
|
24
|
+
|
25
|
+
* Close the pull request to defer the release until more changes have been
|
26
|
+
committed.
|
27
|
+
* Accept the release by merging the pull request, possibly after modifying the
|
28
|
+
changelog.
|
29
|
+
|
30
|
+
Do NOT modify the version in the pull request. If you want to release a
|
31
|
+
different version, see the next section on proposing releases manually.
|
32
|
+
|
33
|
+
When merging a release pull request, make sure the `autorelease: pending` label
|
34
|
+
remains applied. This is important for correct operation of the rest of the
|
35
|
+
release pipeline.
|
36
|
+
|
37
|
+
### Release scripts
|
38
|
+
|
39
|
+
After a release pull request is merged, another bot will trigger the rest of
|
40
|
+
the release pipeline. This bot runs every 15 minutes, so this process may be
|
41
|
+
delayed a few minutes. Once it runs, it will do the following automatically:
|
42
|
+
|
43
|
+
* Tag the release and create a GitHub release. This takes place in a kokoro
|
44
|
+
(internal Google) job. Once finished, it will switch the tag from
|
45
|
+
`autorelease: pending` to `autorelease: tagged`. If it seems to be
|
46
|
+
malfunctioning, you can find logs on the internal fusion dashboard under the
|
47
|
+
job `cloud-devrel/client-libraries/autorelease/tag`.
|
48
|
+
* Build and push the gem to Rubygems, and build and push the documentation to
|
49
|
+
googleapis.dev. This takes place in a second kokoro job. Once finished, it
|
50
|
+
will switch the tag from `autorelease: tagged` to `autorelease: published`.
|
51
|
+
If this job seems to be malfunctioning, find the logs under the kokoro job
|
52
|
+
`cloud-devrel/ruby/functions-framework-ruby/release`.
|
53
|
+
|
54
|
+
## Manually proposing a release
|
55
|
+
|
56
|
+
If you want to propose a release out-of-band or customize the version number to
|
57
|
+
use, you can use a command line tool to create a release pull request.
|
58
|
+
|
59
|
+
### Prerequisites
|
60
|
+
|
61
|
+
You need to install:
|
62
|
+
|
63
|
+
* git version 2.22 or later
|
64
|
+
* The gh cli (https://cli.github.com/)
|
65
|
+
* The release-please npm module
|
66
|
+
* The toys rubygem
|
67
|
+
|
68
|
+
### Running the release proposal script
|
69
|
+
|
70
|
+
Once the prerequisites are installed, run:
|
71
|
+
|
72
|
+
toys release please functions_framework:1.2.3
|
73
|
+
|
74
|
+
(Replace `1.2.3` with the version to release.)
|
75
|
+
|
76
|
+
This will open an appropriate release pull request. Then you can merge it
|
77
|
+
(possibly after modifying the changelog) and the release pipeline will proceed
|
78
|
+
as described above.
|
@@ -306,7 +306,7 @@ module FunctionsFramework
|
|
306
306
|
# @return [Integer]
|
307
307
|
#
|
308
308
|
def max_threads
|
309
|
-
@max_threads ||
|
309
|
+
@max_threads || 8
|
310
310
|
end
|
311
311
|
|
312
312
|
##
|
@@ -352,7 +352,9 @@ module FunctionsFramework
|
|
352
352
|
when ::CloudEvents::CloudEventsError
|
353
353
|
cloud_events_error_response response
|
354
354
|
when ::StandardError
|
355
|
-
|
355
|
+
message = "#{response.class}: #{response.message}"
|
356
|
+
message = [message, *response.backtrace].join "\n\t"
|
357
|
+
error_response message
|
356
358
|
else
|
357
359
|
error_response "Unexpected response type: #{response.class}"
|
358
360
|
end
|
@@ -362,6 +364,10 @@ module FunctionsFramework
|
|
362
364
|
string_response "Not found", 404
|
363
365
|
end
|
364
366
|
|
367
|
+
def no_content_response
|
368
|
+
[204, [], []]
|
369
|
+
end
|
370
|
+
|
365
371
|
def string_response string, status, content_type: nil
|
366
372
|
string.force_encoding ::Encoding::ASCII_8BIT unless string.valid_encoding?
|
367
373
|
if string.encoding == ::Encoding::ASCII_8BIT
|
@@ -387,6 +393,11 @@ module FunctionsFramework
|
|
387
393
|
message = "Unexpected internal error" unless @config.show_error_details?
|
388
394
|
string_response message, 500
|
389
395
|
end
|
396
|
+
|
397
|
+
def flush_streams
|
398
|
+
$stdout.flush
|
399
|
+
$stderr.flush
|
400
|
+
end
|
390
401
|
end
|
391
402
|
|
392
403
|
## @private
|
@@ -401,7 +412,7 @@ module FunctionsFramework
|
|
401
412
|
return notfound_response if excluded_path? env
|
402
413
|
response =
|
403
414
|
begin
|
404
|
-
logger = env[
|
415
|
+
logger = env[::Rack::RACK_LOGGER] ||= @config.logger
|
405
416
|
request = ::Rack::Request.new env
|
406
417
|
logger.info "FunctionsFramework: Handling HTTP #{request.request_method} request"
|
407
418
|
@function.call request, globals: @globals, logger: logger
|
@@ -409,6 +420,8 @@ module FunctionsFramework
|
|
409
420
|
e
|
410
421
|
end
|
411
422
|
interpret_response response
|
423
|
+
ensure
|
424
|
+
flush_streams
|
412
425
|
end
|
413
426
|
end
|
414
427
|
|
@@ -424,7 +437,8 @@ module FunctionsFramework
|
|
424
437
|
|
425
438
|
def call env
|
426
439
|
return notfound_response if excluded_path? env
|
427
|
-
|
440
|
+
return no_content_response if env[::Rack::REQUEST_METHOD] == "GET"
|
441
|
+
logger = env[::Rack::RACK_LOGGER] ||= @config.logger
|
428
442
|
event = decode_event env
|
429
443
|
response =
|
430
444
|
case event
|
@@ -438,6 +452,8 @@ module FunctionsFramework
|
|
438
452
|
raise "Unexpected event type: #{event.class}"
|
439
453
|
end
|
440
454
|
interpret_response response
|
455
|
+
ensure
|
456
|
+
flush_streams
|
441
457
|
end
|
442
458
|
|
443
459
|
private
|
@@ -446,9 +462,8 @@ module FunctionsFramework
|
|
446
462
|
begin
|
447
463
|
@cloud_events.decode_event env
|
448
464
|
rescue ::CloudEvents::NotCloudEventError
|
449
|
-
env[
|
450
|
-
@legacy_events.decode_rack_env(env) ||
|
451
|
-
raise(::CloudEvents::CloudEventsError, "Unrecognized event format")
|
465
|
+
env[::Rack::RACK_INPUT].rewind rescue nil
|
466
|
+
@legacy_events.decode_rack_env(env) || ::CloudEvents::CloudEventsError.new("Unrecognized event format")
|
452
467
|
end
|
453
468
|
rescue ::CloudEvents::CloudEventsError => e
|
454
469
|
e
|
@@ -335,7 +335,8 @@ module FunctionsFramework
|
|
335
335
|
json = ::JSON.dump response
|
336
336
|
string_response json, 200, content_type: "application/json"
|
337
337
|
when ::StandardError
|
338
|
-
message = "#{response.class}: #{response.message}
|
338
|
+
message = "#{response.class}: #{response.message}"
|
339
|
+
message = [message, *response.backtrace].join "\n\t"
|
339
340
|
string_response message, 500
|
340
341
|
else
|
341
342
|
raise "Unexpected response type: #{response.inspect}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: functions_framework
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.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: 2022-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cloud_events
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.7.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 2.a
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: 0.7.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 2.a
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- CHANGELOG.md
|
81
81
|
- LICENSE
|
82
82
|
- README.md
|
83
|
+
- RELEASING.md
|
83
84
|
- bin/functions-framework
|
84
85
|
- bin/functions-framework-ruby
|
85
86
|
- docs/deploying-functions.md
|
@@ -99,10 +100,10 @@ homepage: https://github.com/GoogleCloudPlatform/functions-framework-ruby
|
|
99
100
|
licenses:
|
100
101
|
- Apache-2.0
|
101
102
|
metadata:
|
102
|
-
changelog_uri: https://googlecloudplatform.github.io/functions-framework-ruby/v1.0
|
103
|
+
changelog_uri: https://googlecloudplatform.github.io/functions-framework-ruby/v1.1.0/file.CHANGELOG.html
|
103
104
|
source_code_uri: https://github.com/GoogleCloudPlatform/functions-framework-ruby
|
104
105
|
bug_tracker_uri: https://github.com/GoogleCloudPlatform/functions-framework-ruby/issues
|
105
|
-
documentation_uri: https://googlecloudplatform.github.io/functions-framework-ruby/v1.0
|
106
|
+
documentation_uri: https://googlecloudplatform.github.io/functions-framework-ruby/v1.1.0
|
106
107
|
post_install_message:
|
107
108
|
rdoc_options: []
|
108
109
|
require_paths:
|
@@ -118,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
119
|
- !ruby/object:Gem::Version
|
119
120
|
version: '0'
|
120
121
|
requirements: []
|
121
|
-
rubygems_version: 3.
|
122
|
+
rubygems_version: 3.3.5
|
122
123
|
signing_key:
|
123
124
|
specification_version: 4
|
124
125
|
summary: Functions Framework for Ruby
|