rake-stretcher 0.1.1 → 0.1.2
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/lib/rake/stretcher/tasks/stretcher.rake +15 -15
- data/lib/rake/stretcher/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cf852652d01fd138c90721cfcbfe0b0d056e82c9
|
|
4
|
+
data.tar.gz: b14befb9b9beaa48611fd6c5a14ff58d879d2c1a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a2ee5db89b8204a962a79391cc0fe8b50d8ed9dc76f2c1084df206ddfcfac1c78d6d7f7aacfd92ea87253b6e43fcd192311d4372d20624f7e6342d7a66408674
|
|
7
|
+
data.tar.gz: 8722c6ddc4ce3c21dc27fb7234119467e5f0ebf4232b6c7bf87f442b15f2611bacdb673c57af14fa8884996aac22904e6e3281bbf0d26ddd12205d1c64834b3f
|
|
@@ -38,7 +38,7 @@ namespace :stretcher do
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def branch
|
|
41
|
-
|
|
41
|
+
config['branch'] ||= 'master'
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
def current_version
|
|
@@ -49,12 +49,12 @@ namespace :stretcher do
|
|
|
49
49
|
'--exclude tmp'
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
def
|
|
53
|
-
config['
|
|
52
|
+
def environment
|
|
53
|
+
config['environment'] ||= ENV['environment']
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
def
|
|
57
|
-
config['
|
|
56
|
+
def tarball_name
|
|
57
|
+
config['tarball_name']
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
def stretcher_path
|
|
@@ -62,11 +62,11 @@ namespace :stretcher do
|
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
def stretcher_src
|
|
65
|
-
"#{stretcher_path}
|
|
65
|
+
"#{stretcher_path}/#{remote_tarball_name}-#{time_now}.tgz"
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
def checksum
|
|
69
|
-
%x(openssl sha256 #{local_tarball_path}/current/#{
|
|
69
|
+
%x(openssl sha256 #{local_tarball_path}/current/#{tarball_name} | awk -F' ' '{print $2}').chomp
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
def deploy_to
|
|
@@ -130,7 +130,7 @@ namespace :stretcher do
|
|
|
130
130
|
cd #{local_build_path}
|
|
131
131
|
mkdir -p "#{local_tarball_path}/#{time_now}"
|
|
132
132
|
tar -cf - --exclude tmp --exclude spec ./ | gzip -9 > \
|
|
133
|
-
#{local_tarball_path}/#{time_now}/#{
|
|
133
|
+
#{local_tarball_path}/#{time_now}/#{tarball_name}
|
|
134
134
|
EOC
|
|
135
135
|
sh <<-EOC
|
|
136
136
|
cd #{local_tarball_path}
|
|
@@ -142,7 +142,7 @@ namespace :stretcher do
|
|
|
142
142
|
desc "upload tarball to s3"
|
|
143
143
|
task :upload_tarball do
|
|
144
144
|
sh <<-EOC
|
|
145
|
-
aws s3 cp #{local_tarball_path}/current/#{
|
|
145
|
+
aws s3 cp #{local_tarball_path}/current/#{tarball_name} #{stretcher_src}
|
|
146
146
|
EOC
|
|
147
147
|
end
|
|
148
148
|
|
|
@@ -159,10 +159,10 @@ namespace :stretcher do
|
|
|
159
159
|
end
|
|
160
160
|
p tempfile_path
|
|
161
161
|
sh <<-EOC
|
|
162
|
-
mv #{tempfile_path} "#{local_tarball_path}/current/manifest_#{role}_#{
|
|
162
|
+
mv #{tempfile_path} "#{local_tarball_path}/current/manifest_#{role}_#{environment}_#{time_now}.yml"
|
|
163
163
|
EOC
|
|
164
164
|
sh <<-EOC
|
|
165
|
-
aws s3 cp "#{local_tarball_path}/current/manifest_#{role}_#{
|
|
165
|
+
aws s3 cp "#{local_tarball_path}/current/manifest_#{role}_#{environment}_#{time_now}.yml" "#{manifest_path}/manifest_#{role}_#{environment}_#{time_now}.yml"
|
|
166
166
|
EOC
|
|
167
167
|
end
|
|
168
168
|
end
|
|
@@ -170,11 +170,11 @@ namespace :stretcher do
|
|
|
170
170
|
desc "kick start consul event"
|
|
171
171
|
task :kick_start do
|
|
172
172
|
deploy_roles.each do |role|
|
|
173
|
-
o, e, s = Open3.capture3("aws s3 ls #{manifest_path}/manifest_#{role}_#{
|
|
173
|
+
o, e, s = Open3.capture3("aws s3 ls #{manifest_path}/manifest_#{role}_#{environment} | awk -F' ' '{print $4}' | tail -1")
|
|
174
174
|
current_manifest = o.chomp
|
|
175
175
|
puts "kick start -> #{current_manifest}"
|
|
176
176
|
sh <<-EOC
|
|
177
|
-
curl -X PUT -d "#{manifest_path}/#{current_manifest}" http://#{consul_host}:8500/v1/event/fire/deploy_#{role}_#{
|
|
177
|
+
curl -X PUT -d "#{manifest_path}/#{current_manifest}" http://#{consul_host}:8500/v1/event/fire/deploy_#{role}_#{environment}\?pretty
|
|
178
178
|
EOC
|
|
179
179
|
end
|
|
180
180
|
end
|
|
@@ -182,11 +182,11 @@ namespace :stretcher do
|
|
|
182
182
|
desc "rollback consul event"
|
|
183
183
|
task :rollback do
|
|
184
184
|
deploy_roles.each do |role|
|
|
185
|
-
o, e, s = Open3.capture3("aws s3 ls #{manifest_path}/manifest_#{role}_#{
|
|
185
|
+
o, e, s = Open3.capture3("aws s3 ls #{manifest_path}/manifest_#{role}_#{environment} | awk -F' ' '{print $4}' | tail -2 | head -1")
|
|
186
186
|
current_manifest = o.chomp
|
|
187
187
|
puts "kick start -> #{current_manifest}"
|
|
188
188
|
sh <<-EOC
|
|
189
|
-
curl -X PUT -d "#{manifest_path}/#{current_manifest}" http://#{consul_host}:8500/v1/event/fire/deploy_#{role}_#{
|
|
189
|
+
curl -X PUT -d "#{manifest_path}/#{current_manifest}" http://#{consul_host}:8500/v1/event/fire/deploy_#{role}_#{environment}\?pretty
|
|
190
190
|
EOC
|
|
191
191
|
end
|
|
192
192
|
end
|