eb-docker-deploy 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/deploy/deployer.rb +24 -15
- data/lib/deploy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eed93a0acab6577a0c2ec4ffe056644a36de2e6d
|
4
|
+
data.tar.gz: d50a5f73fd7e3b3c40bbab5f33847733a6dac0e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac1a831ea453c9d7cd235308a8e3a24fe778e711bf7a6a10bc2f0ffc9affa7d46f0026c85fc791b05c374074e674c8c89abfafb8b2fa597e23c931b8ba312d90
|
7
|
+
data.tar.gz: 3ea019cc915720d1b0c433fde05db652c5fbf2bf8456f838a987d60d8a42adfddfa552a992df341fdea229276f759d05824823de6e3c786d566824485309336f
|
data/lib/deploy/deployer.rb
CHANGED
@@ -16,24 +16,26 @@ module Deploy
|
|
16
16
|
f.puts "aws_access_key_id = #{key}"
|
17
17
|
f.puts "aws_secret_access_key = #{secret}"
|
18
18
|
end
|
19
|
-
|
19
|
+
shout('AWS creds successfully configured at ~/.aws/config.') if File.exist?(File.expand_path('~/.aws/config'))
|
20
20
|
end
|
21
21
|
|
22
22
|
method_option :version, aliases: '-v', desc: 'Version'
|
23
|
+
method_option :environment, aliases: '-e', desc: 'Environment'
|
23
24
|
method_option :build, aliases: '-b', desc: 'Build Image'
|
24
25
|
desc 'deploy', 'deploy'
|
25
26
|
def deploy
|
26
27
|
check_setup
|
27
28
|
|
29
|
+
environment = options[:environment]
|
28
30
|
build = options[:build]
|
29
31
|
|
30
32
|
version = options[:version]
|
31
33
|
(shout('You must pass a version with -v'); exit(1)) unless version
|
32
34
|
|
33
35
|
repo = ENV['DOCKER_REPO']
|
34
|
-
|
36
|
+
|
35
37
|
if build
|
36
|
-
|
38
|
+
announce({ color: '#6080C0', title: "Deployment started with build", text: "Deploying version #{version} to #{environment || 'stage'}" })
|
37
39
|
build_image(repo, version)
|
38
40
|
|
39
41
|
tag_image_as_latest(repo, version)
|
@@ -41,24 +43,26 @@ module Deploy
|
|
41
43
|
push_image(repo, version)
|
42
44
|
push_image(repo, 'latest')
|
43
45
|
else
|
44
|
-
|
46
|
+
announce({ color: '#6080C0', title: "Deployment started without build", text: "Deploying version #{version} to #{environment || 'stage'}" })
|
45
47
|
end
|
46
48
|
|
47
|
-
run_deploy(version)
|
48
|
-
|
49
|
+
run_deploy(version, environment)
|
50
|
+
announce({ color: 'good', title: 'Deployment Succeeded!!', text: "The current version of #{environment || 'stage'} is #{version}" })
|
49
51
|
end
|
50
52
|
|
51
53
|
method_option :version, aliases: '-v', desc: 'Version'
|
54
|
+
method_option :environment, aliases: '-e', desc: 'Environment'
|
52
55
|
desc 'rollback', 'rollback'
|
53
56
|
def rollback
|
54
57
|
check_setup
|
55
58
|
|
59
|
+
environment = options[:environment]
|
56
60
|
version = options[:version]
|
57
61
|
(shout('You must pass a version with -v'); exit(1)) unless version
|
58
62
|
|
59
63
|
repo = ENV['DOCKER_REPO']
|
60
64
|
|
61
|
-
|
65
|
+
announce({ color: '#6080C0', title: "Rollback started", text: "Rolling back to #{version} on #{environment || 'stage'}" })
|
62
66
|
|
63
67
|
pull_image(repo, version)
|
64
68
|
|
@@ -66,8 +70,8 @@ module Deploy
|
|
66
70
|
|
67
71
|
push_image(repo, 'latest')
|
68
72
|
|
69
|
-
run_rollback(version)
|
70
|
-
|
73
|
+
run_rollback(version, environment)
|
74
|
+
announce({ color: 'good', title: 'Rollback Succeeded!!', text: "The current version of #{environment || 'stage'} is #{version}" })
|
71
75
|
end
|
72
76
|
|
73
77
|
desc 'send test notification', 'send test notification'
|
@@ -77,6 +81,11 @@ module Deploy
|
|
77
81
|
|
78
82
|
no_commands do
|
79
83
|
|
84
|
+
def announce(attachments)
|
85
|
+
shout("#{attachments[:title]} - #{attachments[:text]}")
|
86
|
+
notifier('', attachments)
|
87
|
+
end
|
88
|
+
|
80
89
|
def notifier(message, attachments)
|
81
90
|
if ENV['SLACK_WEBHOOK']
|
82
91
|
@notifier ||= Slack::Notifier.new(ENV['SLACK_WEBHOOK'])
|
@@ -112,15 +121,15 @@ module Deploy
|
|
112
121
|
exit(1) unless system(command)
|
113
122
|
end
|
114
123
|
|
115
|
-
def run_deploy(version)
|
116
|
-
|
117
|
-
|
124
|
+
def run_deploy(version, environment=nil)
|
125
|
+
command = environment ? "eb deploy #{environment} --label #{version}" : "eb deploy --label #{version}"
|
126
|
+
shout "deploying #{version} to elastic beanstalk with command: #{command}"
|
118
127
|
exit(1) unless system(command)
|
119
128
|
end
|
120
129
|
|
121
|
-
def run_rollback(version)
|
122
|
-
|
123
|
-
|
130
|
+
def run_rollback(version, environment=nil)
|
131
|
+
command = environment ? "eb deploy #{environment} --version #{version}" : "eb deploy --version #{version}"
|
132
|
+
shout "deploying #{version} to elastic beanstalk with command: #{command}"
|
124
133
|
exit(1) unless system(command)
|
125
134
|
end
|
126
135
|
|
data/lib/deploy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eb-docker-deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|