hashicorptools 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +14 -0
- data/.ruby-version +1 -1
- data/README.md +2 -0
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/hashicorptools.gemspec +7 -7
- data/lib/hashicorptools/auto_scaling_group.rb +7 -5
- data/lib/hashicorptools/code_deploy.rb +14 -3
- metadata +8 -5
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 246f2fed394c2713cc6950a0b1b6b05dd3ee85a010dee0af5f3d8a5f56f8c820
|
4
|
+
data.tar.gz: 799d6e3a0afacf388fad6f8633d081d6934f5b9937ad98e4fd150524dcf264cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48a77cc78797da4c0fcd46d277e30a910c40a7bd7130287cef2e4411375f02b0ebea2eafba7e7e3f06e43c4aa1e003ca380165897ce49d2bbcbf63d5734cec35
|
7
|
+
data.tar.gz: f2dd867948a60764a3359d30ac31172b03af77f27904a7839be034f92d958bcdc42c8301b2664772ad4d5105d3c5b87314d1f3c633ac99e17ad7c6036119ffd9
|
@@ -0,0 +1,14 @@
|
|
1
|
+
name: CI
|
2
|
+
on: [push]
|
3
|
+
|
4
|
+
jobs:
|
5
|
+
test:
|
6
|
+
runs-on: ubuntu-latest
|
7
|
+
steps:
|
8
|
+
- uses: actions/checkout@v2
|
9
|
+
- uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
|
10
|
+
with:
|
11
|
+
ruby-version: 2.7
|
12
|
+
bundler-cache: true
|
13
|
+
- run: bundle install
|
14
|
+
- run: bundle exec rspec
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.7.4
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# hashicorptools
|
2
2
|
a set of ruby utilities for interacting with and wrapping packer, terraform and amazon web services.
|
3
3
|
|
4
|
+
![CI Status](https://github.com/controlshift/hashicorptools/actions/workflows/ci.yml/badge.svg)
|
5
|
+
|
4
6
|
## ec2_host
|
5
7
|
|
6
8
|
Allows quick lookup and ssh to machines by role and environment. Queries for instances by AWS tags.
|
data/Rakefile
CHANGED
@@ -15,12 +15,12 @@ require 'juwelier'
|
|
15
15
|
Juwelier::Tasks.new do |gem|
|
16
16
|
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
17
|
gem.name = "hashicorptools"
|
18
|
-
gem.homepage = "http://github.com/
|
18
|
+
gem.homepage = "http://github.com/controlshift/hashicorptools"
|
19
19
|
gem.license = "MIT"
|
20
20
|
gem.summary = %Q{Wrappers for terraform and packer}
|
21
21
|
gem.description = %Q{Wrappers for terraform and packer}
|
22
22
|
gem.email = "systems@controlshiftlabs.com"
|
23
|
-
gem.authors = [
|
23
|
+
gem.authors = ['Kathy Lu', 'Diego Marcet', 'Grey Moore', 'Nathan Woodhull']
|
24
24
|
gem.executables = ['ec2_host']
|
25
25
|
# dependencies defined in Gemfile
|
26
26
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0
|
data/hashicorptools.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: hashicorptools
|
5
|
+
# stub: hashicorptools 2.0.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "hashicorptools".freeze
|
9
|
-
s.version = "
|
9
|
+
s.version = "2.0.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
|
-
s.authors = ["Nathan Woodhull".freeze]
|
14
|
-
s.date = "
|
13
|
+
s.authors = ["Kathy Lu".freeze, "Diego Marcet".freeze, "Grey Moore".freeze, "Nathan Woodhull".freeze]
|
14
|
+
s.date = "2022-01-18"
|
15
15
|
s.description = "Wrappers for terraform and packer".freeze
|
16
16
|
s.email = "systems@controlshiftlabs.com".freeze
|
17
17
|
s.executables = ["ec2_host".freeze]
|
@@ -20,9 +20,9 @@ Gem::Specification.new do |s|
|
|
20
20
|
"README.md"
|
21
21
|
]
|
22
22
|
s.files = [
|
23
|
+
".github/workflows/ci.yml",
|
23
24
|
".ruby-gemset",
|
24
25
|
".ruby-version",
|
25
|
-
".travis.yml",
|
26
26
|
"Gemfile",
|
27
27
|
"LICENSE",
|
28
28
|
"README.md",
|
@@ -42,9 +42,9 @@ Gem::Specification.new do |s|
|
|
42
42
|
"spec/ec2_utilities_spec.rb",
|
43
43
|
"spec/spec_helper.rb"
|
44
44
|
]
|
45
|
-
s.homepage = "http://github.com/
|
45
|
+
s.homepage = "http://github.com/controlshift/hashicorptools".freeze
|
46
46
|
s.licenses = ["MIT".freeze]
|
47
|
-
s.rubygems_version = "3.1.
|
47
|
+
s.rubygems_version = "3.1.6".freeze
|
48
48
|
s.summary = "Wrappers for terraform and packer".freeze
|
49
49
|
|
50
50
|
if s.respond_to? :specification_version then
|
@@ -94,11 +94,13 @@ module Hashicorptools
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def verify_all_instances_using_correct_ami
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
97
|
+
if group.launch_configuration_name
|
98
|
+
launch_configuration = Aws::AutoScaling::LaunchConfiguration.new(name: group.launch_configuration_name, client: autoscaling)
|
99
|
+
image_id = launch_configuration.image_id
|
100
|
+
group.instances.each do |i|
|
101
|
+
instance = Aws::EC2::Instance.new(i.instance_id, client: ec2)
|
102
|
+
raise "#{i.instance_id} has the incorrect AMI, not #{image_id} from current LaunchConfig" if instance.image_id != image_id
|
103
|
+
end
|
102
104
|
end
|
103
105
|
end
|
104
106
|
|
@@ -31,6 +31,9 @@ module Hashicorptools
|
|
31
31
|
})
|
32
32
|
output "created deployment #{response.deployment_id}"
|
33
33
|
output "https://console.aws.amazon.com/codedeploy/home?region=#{aws_region}#/deployments/#{response.deployment_id}"
|
34
|
+
|
35
|
+
# Classes that override this method should return true for a successful deployment, false otherwise
|
36
|
+
return true
|
34
37
|
end
|
35
38
|
|
36
39
|
private
|
@@ -72,9 +75,11 @@ module Hashicorptools
|
|
72
75
|
|
73
76
|
puts "Deploying for regions: #{aws_regions}"
|
74
77
|
|
75
|
-
|
78
|
+
all_succeeded = true
|
76
79
|
aws_regions.each_slice(2) do |aws_regions_batch|
|
77
80
|
puts "Deploying for batch of regions: #{aws_regions_batch}"
|
81
|
+
|
82
|
+
threads = []
|
78
83
|
aws_regions_batch.each do |aws_region|
|
79
84
|
thread = Thread.new{ region_deployment(aws_region).create_deployment(commit.sha, commit.message) }
|
80
85
|
threads.push(thread)
|
@@ -82,13 +87,19 @@ module Hashicorptools
|
|
82
87
|
|
83
88
|
threads.each_with_index do |thread, index|
|
84
89
|
begin
|
85
|
-
thread.join
|
86
|
-
|
90
|
+
# thread.value waits for the thread to finish with #join, then returns the value of the expression
|
91
|
+
thread_succeeded = thread.value
|
92
|
+
all_succeeded = all_succeeded && thread_succeeded
|
93
|
+
rescue StandardError => e
|
87
94
|
# Don't quit whole program on exception in thread, just print exception and exit thread
|
88
95
|
puts "[#{aws_regions[index]}] EXCEPTION: #{e}"
|
96
|
+
all_succeeded = false
|
89
97
|
end
|
90
98
|
end
|
91
99
|
end
|
100
|
+
|
101
|
+
# Return a success or failure status code to be consumed by bash
|
102
|
+
exit(all_succeeded)
|
92
103
|
end
|
93
104
|
|
94
105
|
private
|
metadata
CHANGED
@@ -1,14 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hashicorptools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- Kathy Lu
|
8
|
+
- Diego Marcet
|
9
|
+
- Grey Moore
|
7
10
|
- Nathan Woodhull
|
8
11
|
autorequire:
|
9
12
|
bindir: bin
|
10
13
|
cert_chain: []
|
11
|
-
date:
|
14
|
+
date: 2022-01-18 00:00:00.000000000 Z
|
12
15
|
dependencies:
|
13
16
|
- !ruby/object:Gem::Dependency
|
14
17
|
name: aws-sdk-autoscaling
|
@@ -221,9 +224,9 @@ extra_rdoc_files:
|
|
221
224
|
- LICENSE
|
222
225
|
- README.md
|
223
226
|
files:
|
227
|
+
- ".github/workflows/ci.yml"
|
224
228
|
- ".ruby-gemset"
|
225
229
|
- ".ruby-version"
|
226
|
-
- ".travis.yml"
|
227
230
|
- Gemfile
|
228
231
|
- LICENSE
|
229
232
|
- README.md
|
@@ -242,7 +245,7 @@ files:
|
|
242
245
|
- lib/hashicorptools/variables.rb
|
243
246
|
- spec/ec2_utilities_spec.rb
|
244
247
|
- spec/spec_helper.rb
|
245
|
-
homepage: http://github.com/
|
248
|
+
homepage: http://github.com/controlshift/hashicorptools
|
246
249
|
licenses:
|
247
250
|
- MIT
|
248
251
|
metadata: {}
|
@@ -261,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
261
264
|
- !ruby/object:Gem::Version
|
262
265
|
version: '0'
|
263
266
|
requirements: []
|
264
|
-
rubygems_version: 3.1.
|
267
|
+
rubygems_version: 3.1.6
|
265
268
|
signing_key:
|
266
269
|
specification_version: 4
|
267
270
|
summary: Wrappers for terraform and packer
|