jets 5.0.3 → 5.0.4

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: '09353481e33c3e69347755182cf55dab3b16e50d351bf263d21e20fb6516aa5f'
4
- data.tar.gz: 185f9c67d33250cfd3d406612d3bd34d03179d5abb6c86a540218f2666fc448f
3
+ metadata.gz: a5dfbf6918bc02ab0aa922e66411129fb177f79acbefd26f481b9d0b9e6fe046
4
+ data.tar.gz: 81bde117ec85d14328dc523c20e757123c8e73ea7de508e0ab00f368cce7a38d
5
5
  SHA512:
6
- metadata.gz: 45bd552d7be3599219c725499a406907c24c9344cae56cee664a0a86f292efd6b9dbe81f27f6caabc94f19efb59080c3ff26f53214289d1f0ee11f76083ddaad
7
- data.tar.gz: 536a79ad1957f08184600d86c126d2877ab8e254b7568d1e1b265dc288cae36017b50b254ca0acb06cbbce32111ae6ab37e0303152e9927653d837196f16f3d5
6
+ metadata.gz: e7794943a90301a37af8dc14338e0504a53b0d3ff37ae6a15541c48130194e06078de0d66ef4be6b119db37284ae679c87095e7c252ef4860938aba31ff72af4
7
+ data.tar.gz: 0b768fa41186630d876fd9690003c8c3ff3f70b46ace56a3f325d931dc4ae80dd2a777d2bfe3af0c8f6b73b377a83ab4c0bb3bd2158d3baddd6afcdd7a8cacb5
data/CHANGELOG.md CHANGED
@@ -3,6 +3,11 @@
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.4] - 2023-12-17
7
+ - [#695](https://github.com/rubyonjets/jets/pull/695) dont run reconfigure webpacker unless using
8
+ - [#696](https://github.com/rubyonjets/jets/pull/696) improve deploy failure message by showing nested stack failure message
9
+ - update delete error messaging to stack
10
+
6
11
  ## [5.0.3] - 2023-12-15
7
12
  - [#691](https://github.com/rubyonjets/jets/pull/691) jets deploy fix for empty project
8
13
  - [#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
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "5.0.3"
2
+ VERSION = "5.0.4"
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.4
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-17 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