groundskeeper-bitcore 0.9.0 → 0.10.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/README.md +8 -0
- data/lib/groundskeeper.rb +1 -0
- data/lib/groundskeeper/commands.rb +22 -1
- data/lib/groundskeeper/slack.rb +39 -0
- data/lib/groundskeeper/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 718393692dd1c01682868a2eae64794c25f11e6189b516f88f568a0b1f173de1
|
4
|
+
data.tar.gz: 594af462795ef3b09d9610db8fbe5788096129e2c3d5676ced82174b19935aa7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 074152a71588c99a0a30ae529e7f87955636fa20acd2eb7d988153784bb794a5d51af2d899cb2838d5069adea56f47c3bb3944584f331f1f083a3da43731b683
|
7
|
+
data.tar.gz: 91740b44c7bef4ea9b0358339e12bfa3d05aec61199ae04c41d359435dd918eb74a9f67714f27489fcc2730e15f2cd3b275f446e0a25f3be20b1095b2efe030c
|
data/README.md
CHANGED
@@ -40,6 +40,14 @@ projects. Clone it as follows:
|
|
40
40
|
git clone git@github.com:NU-CBITS/project_details.git ~/.project_details
|
41
41
|
```
|
42
42
|
|
43
|
+
To integrate with Slack, set the following environment variables:
|
44
|
+
|
45
|
+
```bash
|
46
|
+
SLACK_WORKSPACE
|
47
|
+
SLACK_CHANNEL
|
48
|
+
SLACK_TOKEN
|
49
|
+
```
|
50
|
+
|
43
51
|
## Usage
|
44
52
|
|
45
53
|
To display tag/release information about a Rails project, use the `info`
|
data/lib/groundskeeper.rb
CHANGED
@@ -13,6 +13,7 @@ require "groundskeeper/repository"
|
|
13
13
|
require "groundskeeper/rubygems"
|
14
14
|
require "groundskeeper/semantic_version"
|
15
15
|
require "groundskeeper/sentry"
|
16
|
+
require "groundskeeper/slack"
|
16
17
|
require "groundskeeper/ssh"
|
17
18
|
require "groundskeeper/string_utils"
|
18
19
|
require "groundskeeper/version"
|
@@ -30,6 +30,7 @@ module Groundskeeper
|
|
30
30
|
project_name: project.sentry_project,
|
31
31
|
version_prefix: repository.name
|
32
32
|
)
|
33
|
+
slack = Slack.build
|
33
34
|
ssh = Ssh.build(SSH_USERNAME, project.full_dns(stage))
|
34
35
|
|
35
36
|
new(
|
@@ -41,6 +42,7 @@ module Groundskeeper
|
|
41
42
|
repository: repository,
|
42
43
|
rubygems: Rubygems,
|
43
44
|
sentry: sentry,
|
45
|
+
slack: slack,
|
44
46
|
ssh: ssh,
|
45
47
|
version_file: RailsVersion.build,
|
46
48
|
website: website
|
@@ -62,6 +64,7 @@ module Groundskeeper
|
|
62
64
|
repository: nil,
|
63
65
|
rubygems: nil,
|
64
66
|
sentry: nil,
|
67
|
+
slack: nil,
|
65
68
|
ssh: nil,
|
66
69
|
website: nil,
|
67
70
|
version_file:
|
@@ -74,6 +77,7 @@ module Groundskeeper
|
|
74
77
|
@repository = repository
|
75
78
|
@rubygems = rubygems
|
76
79
|
@sentry = sentry
|
80
|
+
@slack = slack
|
77
81
|
@ssh = ssh
|
78
82
|
@website = website
|
79
83
|
@version_file = version_file
|
@@ -147,6 +151,7 @@ module Groundskeeper
|
|
147
151
|
return unrecognized_tag unless tag_present_in_git?(ENV[TAG])
|
148
152
|
return missing_jira_credentials unless jira.credentials?
|
149
153
|
return missing_sentry_credentials unless sentry.credentials?
|
154
|
+
return missing_slack_credentials unless slack.credentials?
|
150
155
|
return unless check_groundskeeper_version
|
151
156
|
return unable_to_ssh unless ssh.can_connect?
|
152
157
|
|
@@ -167,7 +172,8 @@ module Groundskeeper
|
|
167
172
|
|
168
173
|
# collaborators
|
169
174
|
attr_reader :changelog, :console, :git, :jira, :project,
|
170
|
-
:repository, :rubygems, :sentry, :ssh, :version_file,
|
175
|
+
:repository, :rubygems, :sentry, :slack, :ssh, :version_file,
|
176
|
+
:website
|
171
177
|
# state
|
172
178
|
attr_reader :current_step, :did_push_to_remote, :next_version,
|
173
179
|
:recent_commits
|
@@ -315,6 +321,13 @@ module Groundskeeper
|
|
315
321
|
)
|
316
322
|
end
|
317
323
|
|
324
|
+
def missing_slack_credentials
|
325
|
+
console.say(
|
326
|
+
"Please configure your Slack environment variables.",
|
327
|
+
:red
|
328
|
+
)
|
329
|
+
end
|
330
|
+
|
318
331
|
def unable_to_ssh
|
319
332
|
console.say(
|
320
333
|
"Unable to SSH to the server, are you signed into VPN?",
|
@@ -349,6 +362,7 @@ module Groundskeeper
|
|
349
362
|
if deployed_version == ENV[TAG]
|
350
363
|
console.say("# deployment successful", :green)
|
351
364
|
transition_remote_issues deployed_version
|
365
|
+
announce_in_slack deployed_version
|
352
366
|
else
|
353
367
|
# :nocov:
|
354
368
|
console.say(
|
@@ -385,6 +399,13 @@ module Groundskeeper
|
|
385
399
|
end
|
386
400
|
# rubocop:enable Metrics/MethodLength
|
387
401
|
|
402
|
+
def announce_in_slack(deployed_version)
|
403
|
+
slack.send_message(
|
404
|
+
"#{project.project_name} version #{deployed_version} deployed to " +
|
405
|
+
self.class.stage
|
406
|
+
)
|
407
|
+
end
|
408
|
+
|
388
409
|
def announce_step(message)
|
389
410
|
console.say(">>>", :magenta)
|
390
411
|
console.say(">>> #{@current_step}. #{message}", :magenta)
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Groundskeeper
|
4
|
+
# Posts to the RADD #general channel.
|
5
|
+
class Slack
|
6
|
+
COMMAND = "curl"
|
7
|
+
SLACK_WORKSPACE_KEY = "SLACK_WORKSPACE"
|
8
|
+
SLACK_CHANNEL_KEY = "SLACK_CHANNEL"
|
9
|
+
SLACK_TOKEN_KEY = "SLACK_TOKEN"
|
10
|
+
URL = "https://hooks.slack.com/services/" \
|
11
|
+
"%<workspace>s/%<channel>s/%<token>s"
|
12
|
+
SEND_MESSAGE = "-X POST -H 'Content-type: application/json' " \
|
13
|
+
"--data '{\"text\":\"%<message>s\"}' #{URL}"
|
14
|
+
|
15
|
+
attr_reader :slack
|
16
|
+
|
17
|
+
def self.build
|
18
|
+
new Executable.new(COMMAND)
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize(slack)
|
22
|
+
@slack = slack
|
23
|
+
end
|
24
|
+
|
25
|
+
def send_message(message)
|
26
|
+
slack.execute(format(SEND_MESSAGE,
|
27
|
+
message: message,
|
28
|
+
workspace: ENV[SLACK_WORKSPACE_KEY],
|
29
|
+
channel: ENV[SLACK_CHANNEL_KEY],
|
30
|
+
token: ENV[SLACK_TOKEN_KEY]))
|
31
|
+
end
|
32
|
+
|
33
|
+
def credentials?
|
34
|
+
ENV[SLACK_WORKSPACE_KEY].present? &&
|
35
|
+
ENV[SLACK_CHANNEL_KEY].present? &&
|
36
|
+
ENV[SLACK_TOKEN_KEY].present?
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groundskeeper-bitcore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BIT Core
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
11
|
- certs/ericcf.pem
|
12
|
-
date: 2019-11-
|
12
|
+
date: 2019-11-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jira-ruby
|
@@ -196,6 +196,7 @@ files:
|
|
196
196
|
- lib/groundskeeper/rubygems.rb
|
197
197
|
- lib/groundskeeper/semantic_version.rb
|
198
198
|
- lib/groundskeeper/sentry.rb
|
199
|
+
- lib/groundskeeper/slack.rb
|
199
200
|
- lib/groundskeeper/ssh.rb
|
200
201
|
- lib/groundskeeper/string_utils.rb
|
201
202
|
- lib/groundskeeper/version.rb
|