hashicorptools 2.0.0 → 2.1.0
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 +4 -4
- data/VERSION +1 -1
- data/hashicorptools.gemspec +4 -4
- data/lib/hashicorptools/code_deploy.rb +20 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e67a96a4dfde0442db2f2a7765bb8bccef2c2a241a6035a2cc71668cd7c52a2e
|
4
|
+
data.tar.gz: 160e51476f890b2f986277ef7caf9ae18cd72d3062ec0de4a28ef3352757a1a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3b67f51f3fbd83fc526ee4ac71623c045dcd2c0949d0eda49bdd0a09820933a1e2b38c290517a1627c8b6f4c960294e2a3269566337f798d7700c020200446c
|
7
|
+
data.tar.gz: 0c0f240592241afb1956f5f03c34d769b2161b01e50cde3c755eee8da6f5f671901abf6526c0a8bcb041467ac38b846d454f5e875c1c6eb78ce9e72a6b9af7ab
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.1.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 2.
|
5
|
+
# stub: hashicorptools 2.1.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "hashicorptools".freeze
|
9
|
-
s.version = "2.
|
9
|
+
s.version = "2.1.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
13
|
s.authors = ["Kathy Lu".freeze, "Diego Marcet".freeze, "Grey Moore".freeze, "Nathan Woodhull".freeze]
|
14
|
-
s.date = "2022-
|
14
|
+
s.date = "2022-02-03"
|
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]
|
@@ -44,7 +44,7 @@ Gem::Specification.new do |s|
|
|
44
44
|
]
|
45
45
|
s.homepage = "http://github.com/controlshift/hashicorptools".freeze
|
46
46
|
s.licenses = ["MIT".freeze]
|
47
|
-
s.rubygems_version = "3.
|
47
|
+
s.rubygems_version = "3.2.32".freeze
|
48
48
|
s.summary = "Wrappers for terraform and packer".freeze
|
49
49
|
|
50
50
|
if s.respond_to? :specification_version then
|
@@ -50,23 +50,25 @@ module Hashicorptools
|
|
50
50
|
class CodeDeploy < Thor
|
51
51
|
AWS_REGION_US_EAST_1 = 'us-east-1'
|
52
52
|
|
53
|
+
attr_reader :git
|
54
|
+
|
53
55
|
desc 'deploy', 'deploy latest code to environment'
|
54
56
|
option :environment, required: true
|
55
57
|
option :branch
|
56
58
|
option :aws_regions, type: :array
|
57
59
|
option :commit
|
58
60
|
def deploy
|
59
|
-
|
61
|
+
@git = Git.open('..')
|
60
62
|
|
61
63
|
# We set defaults (depending on environment) for aws_regions if not passed in
|
62
64
|
aws_regions = options[:aws_regions] || default_regions
|
63
65
|
|
64
66
|
commit = if options[:commit].present?
|
65
|
-
|
67
|
+
git.gcommit(options[:commit])
|
66
68
|
else
|
67
69
|
branch = options[:branch].nil? ? :main : options[:branch].to_sym
|
68
|
-
|
69
|
-
|
70
|
+
git.checkout(branch)
|
71
|
+
git.log.first
|
70
72
|
end
|
71
73
|
|
72
74
|
puts "Deploying to environment #{options[:environment]} - regions: #{aws_regions.join(', ')}
|
@@ -98,6 +100,11 @@ module Hashicorptools
|
|
98
100
|
end
|
99
101
|
end
|
100
102
|
|
103
|
+
# If deployment succeeded, tag the commit that was deployed for the environment
|
104
|
+
if all_succeeded
|
105
|
+
create_tag(options[:environment], commit)
|
106
|
+
end
|
107
|
+
|
101
108
|
# Return a success or failure status code to be consumed by bash
|
102
109
|
exit(all_succeeded)
|
103
110
|
end
|
@@ -111,5 +118,14 @@ module Hashicorptools
|
|
111
118
|
def default_regions
|
112
119
|
[AWS_REGION_US_EAST_1]
|
113
120
|
end
|
121
|
+
|
122
|
+
def create_tag(environment, commit)
|
123
|
+
# Delete previous tag in the remote repository
|
124
|
+
git.push('origin', ":#{environment}")
|
125
|
+
|
126
|
+
# Create the tag (replacing if it already exists) and push to remote repository
|
127
|
+
git.add_tag(environment, commit.sha, {f: true})
|
128
|
+
git.push('origin', environment)
|
129
|
+
end
|
114
130
|
end
|
115
131
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hashicorptools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kathy Lu
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2022-
|
14
|
+
date: 2022-02-03 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: aws-sdk-autoscaling
|
@@ -264,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
264
264
|
- !ruby/object:Gem::Version
|
265
265
|
version: '0'
|
266
266
|
requirements: []
|
267
|
-
rubygems_version: 3.
|
267
|
+
rubygems_version: 3.2.32
|
268
268
|
signing_key:
|
269
269
|
specification_version: 4
|
270
270
|
summary: Wrappers for terraform and packer
|