lamby 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0617227ed78f3d72343201c0c77d89e174c674f22e6a8c42ed6a07b6b1cec866
4
- data.tar.gz: 8569247f0afb429718263444638a67cef3e765c576217c106e1af9b72025f724
3
+ metadata.gz: dda7dd95836f667a326e727ba2ff18e97f96a080b8ff2be212c7102f8ee61441
4
+ data.tar.gz: 82ede794cb05a15feef3b64073ef3f9b642ce9a3aa6a8ab1508326902907c818
5
5
  SHA512:
6
- metadata.gz: 9a2ac758ac583d5547d2112afbb4a78b6fba6261b7f6eb3e9056378a66f71b827528a6986623818e36aa69c680b67478687d1557a8f851111dddc90155d3428b
7
- data.tar.gz: 287359de5ea4b423f81156e46a5455a739d22b293bb20190c02744a76b0dbd5860b63dfd80177b3aec178be2c8924a81add185a449f43e82c804f79ed17c5702
6
+ metadata.gz: 42c3b2f302aad502ff382d19e663fb34092ff51890bd19d6b25504b55ebae3383b79814b2bcf9786eeb6f56225ea93aaeca142090f8ad97c472c6f96a59b7a72
7
+ data.tar.gz: 4257da43dbdbcbc48f8572b28a62820fca73bb80d2228ac7c06aa1e95032ab57e3a2710169a179d8c00225111810d5a61ed8720c19c43e005f824537c67d11a0
data/CHANGELOG.md CHANGED
@@ -4,6 +4,30 @@
4
4
 
5
5
  See this http://keepachangelog.com link for information on how we want this documented formatted.
6
6
 
7
+ ## v3.1.0
8
+
9
+ #### Added
10
+
11
+ - Add X-Request-Start header for New Relic with API Gateway.
12
+
13
+ ## v3.0.3
14
+
15
+ #### Fixed
16
+
17
+ - Ruby 2.7 Warnings | Logger. Thanks @jessedoyle
18
+
19
+ ## v3.0.2
20
+
21
+ #### Added
22
+
23
+ - Runner now returns STDOUT/STDERR as body.
24
+
25
+ ## v3.0.1
26
+
27
+ #### Fixed
28
+
29
+ - Fix Lambdakiq integration. Thanks #97.
30
+
7
31
  ## v3.0.0
8
32
 
9
33
  #### Added
data/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM lambci/lambda:build-ruby2.7
1
+ FROM public.ecr.aws/sam/build-ruby2.7:1.26.0
2
2
 
3
3
  # Asset Pipeline
4
4
  RUN curl -sL https://rpm.nodesource.com/setup_12.x | bash - && \
data/Gemfile CHANGED
@@ -3,3 +3,7 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
3
  gemspec
4
4
 
5
5
  gem 'rails'
6
+
7
+ group :test do
8
+ gem 'lambdakiq', require: false
9
+ end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lamby (3.0.0)
4
+ lamby (3.1.0)
5
5
  rack
6
6
 
7
7
  GEM
@@ -73,6 +73,9 @@ GEM
73
73
  aws-partitions (~> 1, >= 1.239.0)
74
74
  aws-sigv4 (~> 1.1)
75
75
  jmespath (~> 1.0)
76
+ aws-sdk-sqs (1.38.0)
77
+ aws-sdk-core (~> 3, >= 3.112.0)
78
+ aws-sigv4 (~> 1.1)
76
79
  aws-sdk-ssm (1.108.0)
77
80
  aws-sdk-core (~> 3, >= 3.112.0)
78
81
  aws-sigv4 (~> 1.1)
@@ -88,6 +91,11 @@ GEM
88
91
  i18n (1.8.10)
89
92
  concurrent-ruby (~> 1.0)
90
93
  jmespath (1.4.0)
94
+ lambdakiq (1.0.1)
95
+ activejob
96
+ aws-sdk-sqs
97
+ concurrent-ruby
98
+ railties
91
99
  loofah (2.9.1)
92
100
  crass (~> 1.0.2)
93
101
  nokogiri (>= 1.5.9)
@@ -160,6 +168,7 @@ PLATFORMS
160
168
  DEPENDENCIES
161
169
  aws-sdk-ssm
162
170
  bundler
171
+ lambdakiq
163
172
  lamby!
164
173
  minitest
165
174
  minitest-focus
data/bin/bootstrap CHANGED
@@ -2,5 +2,4 @@
2
2
  set -e
3
3
 
4
4
  echo '== Building containers =='
5
- docker pull lambci/lambda:build-ruby2.7
6
5
  docker-compose build
data/lib/lamby/handler.rb CHANGED
@@ -117,7 +117,7 @@ module Lamby
117
117
  end
118
118
 
119
119
  def lambdakiq?
120
- defined?(::Lambdakiq) && ::Lambdakiq.job?(@event)
120
+ defined?(::Lambdakiq) && ::Lambdakiq.jobs?(@event)
121
121
  end
122
122
 
123
123
  def runner?
data/lib/lamby/logger.rb CHANGED
@@ -7,9 +7,9 @@ unless ENV['LAMBY_TEST']
7
7
  module Lamby
8
8
  module Logger
9
9
 
10
- def initialize(*args)
10
+ def initialize(*args, **kwargs)
11
11
  args[0] = STDOUT
12
- super(*args)
12
+ super(*args, **kwargs)
13
13
  end
14
14
 
15
15
  end
data/lib/lamby/rack.rb CHANGED
@@ -6,6 +6,7 @@ module Lamby
6
6
  LAMBDA_EVENT = 'lambda.event'.freeze
7
7
  LAMBDA_CONTEXT = 'lambda.context'.freeze
8
8
  HTTP_X_REQUESTID = 'HTTP_X_REQUEST_ID'.freeze
9
+ HTTP_X_REQUEST_START = 'HTTP_X_REQUEST_START'.freeze
9
10
  HTTP_COOKIE = 'HTTP_COOKIE'.freeze
10
11
 
11
12
  class << self
@@ -54,6 +55,7 @@ module Lamby
54
55
  "HTTP_#{key.to_s.upcase.tr '-', '_'}"
55
56
  end.tap do |hdrs|
56
57
  hdrs[HTTP_X_REQUESTID] = request_id
58
+ hdrs[HTTP_X_REQUEST_START] = request_start if request_start
57
59
  end
58
60
  end
59
61
 
@@ -109,5 +111,10 @@ module Lamby
109
111
  context.aws_request_id
110
112
  end
111
113
 
114
+ def request_start
115
+ event.dig('requestContext', 'timeEpoch') ||
116
+ event.dig('requestContext', 'requestTimeEpoch')
117
+ end
118
+
112
119
  end
113
120
  end
data/lib/lamby/runner.rb CHANGED
@@ -23,16 +23,18 @@ module Lamby
23
23
 
24
24
  def initialize(event)
25
25
  @event = event
26
+ @body = ''
26
27
  end
27
28
 
28
29
  def call
29
30
  validate!
30
31
  status = Open3.popen3(command, chdir: chdir) do |_stdin, stdout, stderr, thread|
31
- puts stdout.read
32
- puts stderr.read
32
+ @body << stdout.read
33
+ @body << stderr.read
34
+ puts @body
33
35
  thread.value.exitstatus
34
36
  end
35
- [status, {}, StringIO.new('')]
37
+ [status, {}, StringIO.new(@body)]
36
38
  end
37
39
 
38
40
  def command
data/lib/lamby/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lamby
2
- VERSION = '3.0.0'
2
+ VERSION = '3.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lamby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken Collins
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-17 00:00:00.000000000 Z
11
+ date: 2021-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack