jets 5.0.3 → 5.0.5

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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09353481e33c3e69347755182cf55dab3b16e50d351bf263d21e20fb6516aa5f'
4
- data.tar.gz: 185f9c67d33250cfd3d406612d3bd34d03179d5abb6c86a540218f2666fc448f
3
+ metadata.gz: 9188a490c6d04a0c7b0f947442718008cc8724979dfe0f0f49d1302d90185efc
4
+ data.tar.gz: a3f42abadc033434cb21af8b43ed7ecccdfbd41a4da8a4eb23bd959506a3c5e9
5
5
  SHA512:
6
- metadata.gz: 45bd552d7be3599219c725499a406907c24c9344cae56cee664a0a86f292efd6b9dbe81f27f6caabc94f19efb59080c3ff26f53214289d1f0ee11f76083ddaad
7
- data.tar.gz: 536a79ad1957f08184600d86c126d2877ab8e254b7568d1e1b265dc288cae36017b50b254ca0acb06cbbce32111ae6ab37e0303152e9927653d837196f16f3d5
6
+ metadata.gz: f8d64806385a02832b1c14de77f2262b7507dc4090afad9e240740d7ec4ce8fa0c4970cd30d80ccdbd960d70d4248ad7ed1d2efc1bf4e5ddde473c0bc4705279
7
+ data.tar.gz: 7f5cb632fe2bc2de10a986db14921d48b867c352af313192825180fd2a9d7687b75b2ed55772d66b60e266b788297b2e97aabdbfa07a07a466d774861906b3cd
data/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## [5.0.5] - 2023-12-19
7
+ - [#697](https://github.com/rubyonjets/jets/pull/697) fix sqs_queue output url camelcase name
8
+
9
+ ## [5.0.4] - 2023-12-17
10
+ - [#695](https://github.com/rubyonjets/jets/pull/695) dont run reconfigure webpacker unless using
11
+ - [#696](https://github.com/rubyonjets/jets/pull/696) improve deploy failure message by showing nested stack failure message
12
+ - update delete error messaging to stack
13
+
6
14
  ## [5.0.3] - 2023-12-15
7
15
  - [#691](https://github.com/rubyonjets/jets/pull/691) jets deploy fix for empty project
8
16
  - [#692](https://github.com/rubyonjets/jets/pull/692) fix jets deploy for empty project
data/jets.gemspec CHANGED
@@ -48,7 +48,7 @@ Gem::Specification.new do |spec|
48
48
  spec.add_dependency "aws-sdk-ssm"
49
49
  spec.add_dependency "cfn_camelizer", ">= 0.4.9"
50
50
  spec.add_dependency "cfn_response"
51
- spec.add_dependency "cfn-status"
51
+ spec.add_dependency "cfn-status", ">= 0.5.0"
52
52
  spec.add_dependency "cli-format", ">= 0.4.0"
53
53
  spec.add_dependency "dotenv"
54
54
  spec.add_dependency "dsl_evaluator", ">= 0.3.0" # for DslEvaluator.print_code
@@ -279,6 +279,7 @@ module Jets::Builders
279
279
  # when they deploy a jets project in development mode
280
280
  def reconfigure_development_webpacker
281
281
  return unless Jets.env.development?
282
+ return unless gemfile_include?("jetpacker")
282
283
  headline "Reconfiguring webpacker development settings for AWS Lambda."
283
284
 
284
285
  webpacker_yml = "#{"#{stage_area}/code"}/config/webpacker.yml"
data/lib/jets/cfn/ship.rb CHANGED
@@ -31,16 +31,11 @@ module Jets::Cfn
31
31
  end
32
32
  end
33
33
 
34
- success = wait_for_stack
34
+ # waits for /(_COMPLETE|_FAILED)$/ status
35
+ cfn_status = Jets::Cfn::Status.new
36
+ success = cfn_status.wait
35
37
  unless success
36
- puts <<~EOL
37
- The Jets application failed to deploy. Jets creates a few CloudFormation stacks to deploy your application.
38
- The logs above show the CloudFormation parent stack events and points to the stack with the error.
39
- Please go to the CloudFormation console and look for the specific stack with the error.
40
- The specific child stack usually shows more detailed information and can be used to resolve the issue.
41
- Example of checking the CloudFormation console: https://rubyonjets.com/docs/debugging/cloudformation/
42
- EOL
43
- exit 1
38
+ cfn_status.failure_message!
44
39
  end
45
40
 
46
41
  save_apigw_state
@@ -100,11 +95,6 @@ module Jets::Cfn
100
95
  @template ||= Template.new(Jets::Names.parent_template_path, @options)
101
96
  end
102
97
 
103
- # check for /(_COMPLETE|_FAILED)$/ status
104
- def wait_for_stack
105
- Jets::Cfn::Status.new(@options).wait
106
- end
107
-
108
98
  def save_apigw_state
109
99
  Jets::Router::State.save_apigw_state
110
100
  end
@@ -2,9 +2,52 @@ require 'cfn_status'
2
2
 
3
3
  module Jets::Cfn
4
4
  class Status < CfnStatus
5
- def initialize(options={})
6
- @stack_name = Jets::Names.parent_stack_name
7
- super(@stack_name, options)
5
+ extend Memoist
6
+
7
+ def initialize(stack_name = Jets::Names.parent_stack_name, options={})
8
+ super(stack_name, options)
9
+ end
10
+
11
+ def failure_message!
12
+ puts <<~EOL
13
+ The Jets application failed to deploy. Jets creates a few CloudFormation stacks
14
+ to deploy your application. The logs above show the CloudFormation parent stack
15
+ events. You can go to the CloudFormation console and look for the nested stack
16
+ with the error. The specific nested stack usually shows more detailed information
17
+ and can be used to resolve the issue.
18
+ Example of checking the CloudFormation console:
19
+
20
+ https://rubyonjets.com/docs/debugging/cloudformation/
21
+
22
+ EOL
23
+
24
+ show_nested_stack_error
25
+
26
+ exit 1
27
+ end
28
+
29
+ def show_nested_stack_error
30
+ event = find_failed_event
31
+ return unless event
32
+ puts "-" * 80
33
+ puts "Here's the nested stack error details: #{event.resource_status_reason}"
34
+ self.class.new(event.physical_resource_id, start_index_before_delete: true).run
35
+
36
+ region = Jets.aws.region
37
+ puts <<~EOL
38
+ Here's also the AWS Console link to the failed nested stack:
39
+
40
+ https://#{region}.console.aws.amazon.com/cloudformation/home?region=#{region}#/stacks/events?filteringText=&filteringStatus=active&viewNested=true&stackId=#{event.physical_resource_id}
41
+
42
+ EOL
43
+ end
44
+
45
+ def find_failed_event
46
+ cfn_status = self.class.new # fresh instance to get the refreshed events
47
+ cfn_status.refresh_events
48
+ i = cfn_status.start_index
49
+ events = cfn_status.events[0..i].reverse # events are in reverse chronological order
50
+ events.find { |e| e.resource_status =~ /FAILED/ } # first failed event
8
51
  end
9
52
  end
10
53
  end
@@ -44,7 +44,7 @@ module Jets::Command
44
44
  end
45
45
 
46
46
  def wait_for_stack
47
- status = Jets::Cfn::Status.new(@options)
47
+ status = Jets::Cfn::Status.new
48
48
  start_time = Time.now
49
49
  status.wait
50
50
  took = Time.now - start_time
@@ -60,7 +60,7 @@ module Jets::Command
60
60
  def confirm_project_exists
61
61
  stack = find_stack(parent_stack_name)
62
62
  return if stack
63
- puts "ERROR: Project #{parent_stack_name} does not exist".color(:red)
63
+ puts "ERROR: Stack #{parent_stack_name} does not exist".color(:red)
64
64
  exit 1
65
65
  end
66
66
 
@@ -44,8 +44,8 @@ module Jets::Command
44
44
  def delete_minimal_stack
45
45
  puts "Existing stack is in ROLLBACK_COMPLETE state from a previous failed minimal deploy. Deleting stack and continuing."
46
46
  cfn.delete_stack(stack_name: stack_name)
47
- status.wait
48
- status.reset
47
+ cfn_status.wait
48
+ cfn_status.reset
49
49
  end
50
50
 
51
51
  def check_dev_mode
@@ -69,8 +69,8 @@ module Jets::Command
69
69
  Jets::Cfn::Ship.new(options).run
70
70
  end
71
71
 
72
- def status
73
- @status ||= Jets::Cfn::Status.new(stack_name)
72
+ def cfn_status
73
+ @cfn_status ||= Jets::Cfn::Status.new(stack_name)
74
74
  end
75
75
 
76
76
  def stack_name
@@ -1,9 +1,16 @@
1
1
  module Jets::Command
2
2
  class StatusCommand < Base
3
+ include Jets::AwsServices
4
+
3
5
  desc "status", "Shows the current status of the Jets app"
4
6
  long_desc Help.text(:status)
5
7
  def perform
6
- Jets::Cfn::Status.new(options).run
8
+ Jets.boot
9
+ cfn_status = Jets::Cfn::Status.new
10
+ success = cfn_status.run
11
+ unless success
12
+ cfn_status.failure_message!
13
+ end
7
14
  end
8
15
  end
9
16
  end
@@ -245,13 +245,11 @@ module Jets::Lambda::Dsl
245
245
  end
246
246
 
247
247
  def ref(name)
248
- name = name.is_a?(Symbol) ? name.to_s.camelize : name
249
- "!Ref #{name}"
248
+ "!Ref #{name.to_s.camelize}"
250
249
  end
251
250
 
252
251
  def sub(value)
253
- value = value.is_a?(Symbol) ? value.to_s.camelize : value
254
- "!Sub #{value}"
252
+ "!Sub #{value.to_s.camelize}"
255
253
  end
256
254
 
257
255
  # meth is a Symbol
@@ -4,7 +4,7 @@ module Jets::Stack::Main::Dsl
4
4
  # props[:queue_name] ||= id.to_s # comment out to allow CloudFormation to generate name
5
5
  resource(id, "AWS::SQS::Queue", props)
6
6
  output(id, Value: get_att("#{id}.Arn")) # normal !Ref returns the sqs url the ARN is useful for nested stacks depends_on
7
- output("#{id}Url", ref(id)) # useful for Stack.lookup method. IE: List.lookup(:waitlist_url)
7
+ output("#{id}_url", ref(id)) # useful for Stack.lookup method. IE: List.lookup(:waitlist_url)
8
8
  end
9
9
  end
10
10
  end
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "5.0.3"
2
+ VERSION = "5.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jets
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.3
4
+ version: 5.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-15 00:00:00.000000000 Z
11
+ date: 2023-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -296,14 +296,14 @@ dependencies:
296
296
  requirements:
297
297
  - - ">="
298
298
  - !ruby/object:Gem::Version
299
- version: '0'
299
+ version: 0.5.0
300
300
  type: :runtime
301
301
  prerelease: false
302
302
  version_requirements: !ruby/object:Gem::Requirement
303
303
  requirements:
304
304
  - - ">="
305
305
  - !ruby/object:Gem::Version
306
- version: '0'
306
+ version: 0.5.0
307
307
  - !ruby/object:Gem::Dependency
308
308
  name: cli-format
309
309
  requirement: !ruby/object:Gem::Requirement