forger 3.0.0 → 3.0.1

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: c6a2c42b3903e698ada5e5ea866c96132f5de9013ab48e6a3ebab3164ef376a2
4
- data.tar.gz: 8aee63e946e05d816eb6978d9ce3b504a50f8ae413287d181d2cf05717020078
3
+ metadata.gz: 7fc8c6d76b747fc55f5fc08740f4c43807f7d9d2a7a74da43f6bdd5814179e5c
4
+ data.tar.gz: dbb1fb1fdd04a2e2ae227ae9313aa2f8f361aeff7b2f7f361a155b38e83020d6
5
5
  SHA512:
6
- metadata.gz: 3c8acac50ce6b424cb2dfe29069cb92b774903b8ff6d7eb07ab043a98c82ad916d8f610841f9ad1ecd18b39829903d259221f588b726bc8d80d867a9e81f80f0
7
- data.tar.gz: 90bfbe3f61a0f05a0ac893b0250678204b25c0be844ef300f2c2d0be3df849512beac1708729fe857c4b7382310922d8e4d3c7730c73f52e201d370949a55efa
6
+ metadata.gz: d2c4fd91ba29783675f06bbcb7b07955ba9ecfeca86cbf5d8f87de71cdb328567191d6cb9c03703c202078c848827c99f89008ac897916456f91f6375802e2c5
7
+ data.tar.gz: a2a01d68a8e4f53774bc6a977de6e13145e057a0e34047e115586ad7799e5bf7cbd05110c63df1690728b524074c7b0f0fac5aa2f501670b79f4beb5fc096c42
@@ -3,6 +3,11 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [3.0.1]
7
+ - edge case when reserverations not immediately found yet
8
+ - fix `sync_scripts_to_s3` with clean slate no forger bucket created yet
9
+ - simplify app/scripts upload s3 bucket logic
10
+
6
11
  ## [3.0.0]
7
12
  * there are some breaking changes with this release
8
13
  * automatically created a forger managed s3 bucket when extract_scripts usage detected
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- forger (2.0.5)
4
+ forger (3.0.0)
5
5
  activesupport
6
6
  aws-sdk-cloudformation
7
7
  aws-sdk-ec2
@@ -8,8 +8,8 @@ module Forger
8
8
 
9
9
  def run
10
10
  Profile.new(@options).check!
11
-
12
11
  Hook.run(:before_run_instances, @options)
12
+
13
13
  sync_scripts_to_s3
14
14
 
15
15
  puts "Creating EC2 instance #{@name.color(:green)}"
@@ -19,6 +19,7 @@ module Forger
19
19
  puts "NOOP mode enabled. EC2 instance not created."
20
20
  return
21
21
  end
22
+
22
23
  resp = run_instances(params)
23
24
 
24
25
  instance_id = resp.instances.first.instance_id
@@ -38,7 +39,6 @@ module Forger
38
39
 
39
40
  def sync_scripts_to_s3
40
41
  upload = Script::Upload.new(@options)
41
- return if upload.empty?
42
42
  upload.run
43
43
  end
44
44
 
@@ -34,6 +34,7 @@ class Forger::Create
34
34
  reservation = resp.reservations.first
35
35
  # Super edge case when reserverations not immediately found yet
36
36
  until reservation
37
+ resp = ec2.describe_instances(instance_ids: [instance_id])
37
38
  reservation = resp.reservations.first
38
39
  seconds = 0.5
39
40
  puts "Reserveration not found. Sleeping for #{seconds} and will try again."
@@ -45,13 +46,6 @@ class Forger::Create
45
46
  puts "Spot instance request id: #{spot_id}"
46
47
  end
47
48
 
48
- def monthly_spot_price
49
- max_price = @params[:instance_market_options][:spot_options][:max_price].to_f
50
- monthly_price = max_price * 24 * 30
51
- "%.2f" % monthly_price
52
- rescue
53
- end
54
-
55
49
  def launch_template
56
50
  launch_template = params[:launch_template]
57
51
  return unless launch_template
@@ -14,8 +14,9 @@ class Forger::Script
14
14
  end
15
15
 
16
16
  def run
17
- compiler.compile_scripts if @compile
17
+ return if empty?
18
18
  ensure_bucket_exists
19
+ compiler.compile_scripts if @compile
19
20
  compressor.compress
20
21
  upload(tarball_path)
21
22
  compressor.clean
@@ -23,7 +24,7 @@ class Forger::Script
23
24
  end
24
25
 
25
26
  def ensure_bucket_exists
26
- Forger::S3::Bucket.ensure_exists! if Forger::Template::Helper.extract_scripts_registered?
27
+ Forger::S3::Bucket.ensure_exists!
27
28
  end
28
29
 
29
30
  def upload(tarball_path)
@@ -8,10 +8,5 @@ module Forger::Template
8
8
  include ScriptHelper
9
9
  include SshKeyHelper
10
10
  extend self
11
-
12
- @@extract_scripts_registered = false
13
- def extract_scripts_registered?
14
- @@extract_scripts_registered
15
- end
16
11
  end
17
12
  end
@@ -1,8 +1,6 @@
1
1
  module Forger::Template::Helper::ScriptHelper
2
2
  # Bash code that is meant to included in user-data
3
3
  def extract_scripts(options={})
4
- @@extract_scripts_registered = true
5
-
6
4
  settings_options = settings["extract_scripts"] || {}
7
5
  options = settings_options.merge(options)
8
6
  # defaults also here in case they are removed from settings
@@ -1,3 +1,3 @@
1
1
  module Forger
2
- VERSION = "3.0.0"
2
+ VERSION = "3.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forger
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-01 00:00:00.000000000 Z
11
+ date: 2019-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport