ops_deploy 0.1.8.2 → 0.1.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ops_deploy/cli.rb +3 -7
- data/lib/ops_deploy/cli/notifier.rb +43 -28
- data/lib/ops_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: f982c964034710b65572b3ea37c1787eec0a0fd7
|
4
|
+
data.tar.gz: d9d586c32696fd1665771048f81076009c3ddaf7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35cb437678df6c7f21afc1d94a3d452995299c32f2549a234f41e11c5cec69ccd15aa491b2f613af385dc4b4e82c881adc39b079bf8c064ec9f0d439d1c05f3e
|
7
|
+
data.tar.gz: a1e2eaa8072f5e2b7273a1ee0ef5ac6bc7bd47919a8dc134ee26523f685afb9761e1533810bf9d6bc6487d8d9d3a40438d2e662b54745f0914cf803616da488c
|
data/lib/ops_deploy/cli.rb
CHANGED
@@ -60,18 +60,15 @@ class OpsDeploy::CLI
|
|
60
60
|
slack: @notifier.options[:slack])
|
61
61
|
else
|
62
62
|
step_msg('Checking deployments...')
|
63
|
-
notify_user = @notifier.notify_user
|
64
63
|
|
65
64
|
@main.deployments_callback = proc { |deployment|
|
66
65
|
puts
|
67
66
|
if (deployment.status == 'successful')
|
68
67
|
success_msg('Deployment', 'OK'.green.bold,
|
69
|
-
deployment.duration ? "(#{deployment.duration}s)" : ''
|
70
|
-
notify_user ? "@#{notify_user}" : '')
|
68
|
+
deployment.duration ? "(#{deployment.duration}s)" : '')
|
71
69
|
else
|
72
70
|
failure_msg('Deployment', 'Failed'.red.bold,
|
73
|
-
deployment.duration ? "(#{deployment.duration}s)" : ''
|
74
|
-
notify_user ? "@#{notify_user}" : '')
|
71
|
+
deployment.duration ? "(#{deployment.duration}s)" : '')
|
75
72
|
end
|
76
73
|
}
|
77
74
|
|
@@ -84,8 +81,7 @@ class OpsDeploy::CLI
|
|
84
81
|
|
85
82
|
info_msg('Deployments finished')
|
86
83
|
else
|
87
|
-
info_msg('No running deployments on stack', "'#{stack_id_name_or_object.blue}'"
|
88
|
-
notify_user ? "@#{notify_user}" : '')
|
84
|
+
info_msg('No running deployments on stack', "'#{stack_id_name_or_object.blue}'")
|
89
85
|
end
|
90
86
|
|
91
87
|
send_notification(stack)
|
@@ -3,14 +3,12 @@ class OpsDeploy::CLI::Notifier
|
|
3
3
|
attr_accessor :options
|
4
4
|
attr_accessor :messages
|
5
5
|
attr_accessor :notification_type
|
6
|
-
attr_accessor :notify_user
|
7
6
|
|
8
7
|
def initialize(options)
|
9
8
|
@options = options
|
10
9
|
@options.delete(:slack) if @options[:slack].nil? || @options[:slack][:webhook_url].nil?
|
11
10
|
@messages = OpsDeploy::CLI::Notifier::Messages.new
|
12
11
|
@notification_type = :info
|
13
|
-
@notify_user = @options[:slack] ? @options[:slack][:notify_user] : nil
|
14
12
|
end
|
15
13
|
|
16
14
|
def notify(stack)
|
@@ -82,40 +80,57 @@ class OpsDeploy::CLI::Notifier::Slack < OpsDeploy::CLI::Notifier::Generic
|
|
82
80
|
|
83
81
|
def notify(message)
|
84
82
|
message = message.gsub(/\[[0-9;]+?m/, '')
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
83
|
+
|
84
|
+
recipients.each do |recipient|
|
85
|
+
@slack_notifier.ping '', channel: recipient, attachments: [
|
86
|
+
{
|
87
|
+
fallback: message,
|
88
|
+
author_name: @stack.name,
|
89
|
+
author_link: stack_link(@stack),
|
90
|
+
text: message
|
91
|
+
}
|
92
|
+
]
|
93
|
+
end
|
93
94
|
end
|
94
95
|
|
95
96
|
def success_notify(message)
|
96
97
|
message = message.gsub(/\[[0-9;]+?m/, '')
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
98
|
+
|
99
|
+
recipients.each do |recipient|
|
100
|
+
@slack_notifier.ping '', channel: recipient, attachments: [
|
101
|
+
{
|
102
|
+
fallback: message,
|
103
|
+
text: message,
|
104
|
+
author_name: @stack.name,
|
105
|
+
author_link: stack_link(@stack),
|
106
|
+
color: 'good'
|
107
|
+
}
|
108
|
+
]
|
109
|
+
end
|
106
110
|
end
|
107
111
|
|
108
112
|
def failure_notify(message)
|
109
113
|
message = message.gsub(/\[[0-9;]+?m/, '')
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
114
|
+
|
115
|
+
recipients.each do |recipient|
|
116
|
+
@slack_notifier.ping '', channel: recipient, attachments: [
|
117
|
+
{
|
118
|
+
fallback: message,
|
119
|
+
text: "#{message} <!channel>",
|
120
|
+
author_name: @stack.name,
|
121
|
+
author_link: stack_link(@stack),
|
122
|
+
color: 'danger'
|
123
|
+
}
|
124
|
+
]
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
private
|
129
|
+
|
130
|
+
def recipients
|
131
|
+
names = [options[:channel]]
|
132
|
+
names << "@#{options[:notify_user]}" if options[:notify_user]
|
133
|
+
names
|
119
134
|
end
|
120
135
|
|
121
136
|
def stack_link(stack)
|
data/lib/ops_deploy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ops_deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.8.
|
4
|
+
version: 0.1.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mahdi Bchetnia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|