rake_slack 0.2.0.pre.1
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 +7 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +208 -0
- data/LICENSE.txt +21 -0
- data/README.md +123 -0
- data/Rakefile +194 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/rake_slack/client.rb +50 -0
- data/lib/rake_slack/exceptions/delivery_failed.rb +8 -0
- data/lib/rake_slack/exceptions/no_matching_rule.rb +14 -0
- data/lib/rake_slack/exceptions.rb +4 -0
- data/lib/rake_slack/tasks/notify.rb +133 -0
- data/lib/rake_slack/tasks.rb +3 -0
- data/lib/rake_slack/version.rb +5 -0
- data/lib/rake_slack.rb +12 -0
- data/rake_slack.gemspec +59 -0
- metadata +292 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8ed2b3f9e08c489e6928e2e1b838cfc131cb7fe4cf3fc17fc805cd0addbeba04
|
|
4
|
+
data.tar.gz: 8bd4af4ed0f0f2e9aa4973b813632c90118004aebd733dedd571addea4b67543
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ab9ae8c5787a5c4fe517a9591fce09c6fba2f53633b2c2bba268bb889670cffe997ca2e90ae536609bbefd0691c2b05941e42ef10cb9f7325c0d07774b9799a3
|
|
7
|
+
data.tar.gz: 69d2bf90e2b2d55cbb60eafc1bf464dec9b420befc57c7137b7bfbb1e8804d572fec485eff277245152004c5919f13e07c4ccdac324b4125075d8fd44b269d19
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of
|
|
9
|
+
experience, nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or reject
|
|
41
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
42
|
+
not aligned to this Code of Conduct, or to ban temporarily or permanently any
|
|
43
|
+
contributor for other behaviors that they deem inappropriate, threatening,
|
|
44
|
+
offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at maintainers@infrablocks.io. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
|
62
|
+
incident. Further details of specific enforcement policies may be posted
|
|
63
|
+
separately.
|
|
64
|
+
|
|
65
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
66
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
67
|
+
members of the project's leadership.
|
|
68
|
+
|
|
69
|
+
## Attribution
|
|
70
|
+
|
|
71
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
72
|
+
version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
|
73
|
+
|
|
74
|
+
[homepage]: http://contributor-covenant.org
|
|
75
|
+
|
|
76
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
rake_slack (0.2.0.pre.1)
|
|
5
|
+
excon (>= 0.72, < 2.0)
|
|
6
|
+
rake_factory (~> 0.33)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
activesupport (8.1.3)
|
|
12
|
+
base64
|
|
13
|
+
bigdecimal
|
|
14
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
15
|
+
connection_pool (>= 2.2.5)
|
|
16
|
+
drb
|
|
17
|
+
i18n (>= 1.6, < 2)
|
|
18
|
+
json
|
|
19
|
+
logger (>= 1.4.2)
|
|
20
|
+
minitest (>= 5.1)
|
|
21
|
+
securerandom (>= 0.3)
|
|
22
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
23
|
+
uri (>= 0.13.1)
|
|
24
|
+
addressable (2.9.0)
|
|
25
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
26
|
+
ast (2.4.3)
|
|
27
|
+
base64 (0.3.0)
|
|
28
|
+
bigdecimal (4.1.2)
|
|
29
|
+
childprocess (5.0.0)
|
|
30
|
+
colored2 (3.1.2)
|
|
31
|
+
concurrent-ruby (1.3.7)
|
|
32
|
+
connection_pool (3.0.2)
|
|
33
|
+
diff-lcs (1.6.2)
|
|
34
|
+
docile (1.4.1)
|
|
35
|
+
drb (2.2.3)
|
|
36
|
+
excon (1.5.0)
|
|
37
|
+
logger
|
|
38
|
+
faraday (2.14.3)
|
|
39
|
+
faraday-net_http (>= 2.0, < 3.5)
|
|
40
|
+
json
|
|
41
|
+
logger
|
|
42
|
+
faraday-net_http (3.4.4)
|
|
43
|
+
net-http (~> 0.5)
|
|
44
|
+
ffi (1.17.4)
|
|
45
|
+
ffi (1.17.4-aarch64-linux-gnu)
|
|
46
|
+
ffi (1.17.4-aarch64-linux-musl)
|
|
47
|
+
ffi (1.17.4-arm-linux-gnu)
|
|
48
|
+
ffi (1.17.4-arm-linux-musl)
|
|
49
|
+
ffi (1.17.4-arm64-darwin)
|
|
50
|
+
ffi (1.17.4-x86-linux-gnu)
|
|
51
|
+
ffi (1.17.4-x86-linux-musl)
|
|
52
|
+
ffi (1.17.4-x86_64-darwin)
|
|
53
|
+
ffi (1.17.4-x86_64-linux-gnu)
|
|
54
|
+
ffi (1.17.4-x86_64-linux-musl)
|
|
55
|
+
gem-release (2.2.4)
|
|
56
|
+
git (1.19.1)
|
|
57
|
+
addressable (~> 2.8)
|
|
58
|
+
rchardet (~> 1.8)
|
|
59
|
+
hamster (3.0.0)
|
|
60
|
+
concurrent-ruby (~> 1.0)
|
|
61
|
+
i18n (1.15.2)
|
|
62
|
+
concurrent-ruby (~> 1.0)
|
|
63
|
+
immutable-struct (2.5.0)
|
|
64
|
+
json (2.20.0)
|
|
65
|
+
language_server-protocol (3.17.0.6)
|
|
66
|
+
lino (4.1.0)
|
|
67
|
+
childprocess (~> 5.0.0)
|
|
68
|
+
hamster (~> 3.0)
|
|
69
|
+
open4 (~> 1.3)
|
|
70
|
+
lint_roller (1.1.0)
|
|
71
|
+
logger (1.7.0)
|
|
72
|
+
minitest (6.0.6)
|
|
73
|
+
drb (~> 2.0)
|
|
74
|
+
prism (~> 1.5)
|
|
75
|
+
net-http (0.9.1)
|
|
76
|
+
uri (>= 0.11.1)
|
|
77
|
+
octokit (10.0.0)
|
|
78
|
+
faraday (>= 1, < 3)
|
|
79
|
+
sawyer (~> 0.9)
|
|
80
|
+
open4 (1.3.4)
|
|
81
|
+
parallel (1.28.0)
|
|
82
|
+
parser (3.3.11.1)
|
|
83
|
+
ast (~> 2.4.1)
|
|
84
|
+
racc
|
|
85
|
+
prism (1.9.0)
|
|
86
|
+
public_suffix (7.0.5)
|
|
87
|
+
racc (1.8.1)
|
|
88
|
+
rainbow (3.1.1)
|
|
89
|
+
rake (13.4.2)
|
|
90
|
+
rake_factory (0.33.0)
|
|
91
|
+
activesupport (>= 4)
|
|
92
|
+
rake (~> 13.0)
|
|
93
|
+
rake_git (0.2.0)
|
|
94
|
+
colored2 (~> 3.1)
|
|
95
|
+
git (~> 1.13, >= 1.13.2)
|
|
96
|
+
rake_factory (~> 0.33)
|
|
97
|
+
rake_git_crypt (0.2.0)
|
|
98
|
+
colored2 (~> 3.1)
|
|
99
|
+
rake_factory (~> 0.33)
|
|
100
|
+
ruby_git_crypt (~> 0.1)
|
|
101
|
+
ruby_gpg2 (~> 0.12)
|
|
102
|
+
rake_github (0.17.0)
|
|
103
|
+
colored2 (~> 3.1)
|
|
104
|
+
octokit (>= 7.0, < 11.0)
|
|
105
|
+
rake_factory (~> 0.33)
|
|
106
|
+
rbnacl (~> 7.1)
|
|
107
|
+
sshkey (~> 2.0)
|
|
108
|
+
rake_gpg (0.20.0)
|
|
109
|
+
rake_factory (~> 0.33)
|
|
110
|
+
ruby_gpg2 (~> 0.12)
|
|
111
|
+
rake_ssh (0.12.0)
|
|
112
|
+
colored2 (~> 3.1)
|
|
113
|
+
rake_factory (~> 0.33)
|
|
114
|
+
sshkey (~> 2.0)
|
|
115
|
+
rbnacl (7.1.2)
|
|
116
|
+
ffi (~> 1)
|
|
117
|
+
rchardet (1.10.2)
|
|
118
|
+
regexp_parser (2.12.0)
|
|
119
|
+
rspec (3.13.2)
|
|
120
|
+
rspec-core (~> 3.13.0)
|
|
121
|
+
rspec-expectations (~> 3.13.0)
|
|
122
|
+
rspec-mocks (~> 3.13.0)
|
|
123
|
+
rspec-core (3.13.6)
|
|
124
|
+
rspec-support (~> 3.13.0)
|
|
125
|
+
rspec-expectations (3.13.5)
|
|
126
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
127
|
+
rspec-support (~> 3.13.0)
|
|
128
|
+
rspec-mocks (3.13.8)
|
|
129
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
130
|
+
rspec-support (~> 3.13.0)
|
|
131
|
+
rspec-support (3.13.7)
|
|
132
|
+
rubocop (1.88.2)
|
|
133
|
+
json (~> 2.3)
|
|
134
|
+
language_server-protocol (~> 3.17.0.2)
|
|
135
|
+
lint_roller (~> 1.1.0)
|
|
136
|
+
parallel (>= 1.10)
|
|
137
|
+
parser (>= 3.3.0.2)
|
|
138
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
139
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
140
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
141
|
+
ruby-progressbar (~> 1.7)
|
|
142
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
143
|
+
rubocop-ast (1.50.0)
|
|
144
|
+
parser (>= 3.3.7.2)
|
|
145
|
+
prism (~> 1.7)
|
|
146
|
+
rubocop-rake (0.7.1)
|
|
147
|
+
lint_roller (~> 1.1)
|
|
148
|
+
rubocop (>= 1.72.1)
|
|
149
|
+
rubocop-rspec (3.10.2)
|
|
150
|
+
lint_roller (~> 1.1)
|
|
151
|
+
regexp_parser (>= 2.0)
|
|
152
|
+
rubocop (~> 1.86, >= 1.86.2)
|
|
153
|
+
ruby-progressbar (1.13.0)
|
|
154
|
+
ruby_git_crypt (0.1.0)
|
|
155
|
+
immutable-struct (~> 2.4)
|
|
156
|
+
lino (>= 4.1)
|
|
157
|
+
ruby_gpg2 (0.12.0)
|
|
158
|
+
lino (>= 4.1)
|
|
159
|
+
sawyer (0.9.3)
|
|
160
|
+
addressable (>= 2.3.5)
|
|
161
|
+
faraday (>= 0.17.3, < 3)
|
|
162
|
+
securerandom (0.4.1)
|
|
163
|
+
simplecov (0.22.0)
|
|
164
|
+
docile (~> 1.1)
|
|
165
|
+
simplecov-html (~> 0.11)
|
|
166
|
+
simplecov_json_formatter (~> 0.1)
|
|
167
|
+
simplecov-html (0.13.2)
|
|
168
|
+
simplecov_json_formatter (0.1.4)
|
|
169
|
+
sshkey (2.0.0)
|
|
170
|
+
tzinfo (2.0.6)
|
|
171
|
+
concurrent-ruby (~> 1.0)
|
|
172
|
+
unicode-display_width (3.2.0)
|
|
173
|
+
unicode-emoji (~> 4.1)
|
|
174
|
+
unicode-emoji (4.2.0)
|
|
175
|
+
uri (1.1.1)
|
|
176
|
+
|
|
177
|
+
PLATFORMS
|
|
178
|
+
aarch64-linux-gnu
|
|
179
|
+
aarch64-linux-musl
|
|
180
|
+
arm-linux-gnu
|
|
181
|
+
arm-linux-musl
|
|
182
|
+
arm64-darwin
|
|
183
|
+
ruby
|
|
184
|
+
x86-linux-gnu
|
|
185
|
+
x86-linux-musl
|
|
186
|
+
x86_64-darwin
|
|
187
|
+
x86_64-linux-gnu
|
|
188
|
+
x86_64-linux-musl
|
|
189
|
+
|
|
190
|
+
DEPENDENCIES
|
|
191
|
+
activesupport
|
|
192
|
+
bundler
|
|
193
|
+
gem-release
|
|
194
|
+
rake
|
|
195
|
+
rake_git
|
|
196
|
+
rake_git_crypt
|
|
197
|
+
rake_github
|
|
198
|
+
rake_gpg
|
|
199
|
+
rake_slack!
|
|
200
|
+
rake_ssh
|
|
201
|
+
rspec
|
|
202
|
+
rubocop
|
|
203
|
+
rubocop-rake
|
|
204
|
+
rubocop-rspec
|
|
205
|
+
simplecov
|
|
206
|
+
|
|
207
|
+
BUNDLED WITH
|
|
208
|
+
2.5.15
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 InfraBlocks Maintainers
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# RakeSlack
|
|
2
|
+
|
|
3
|
+
Rake tasks for posting CI build outcomes to Slack. A configurable,
|
|
4
|
+
first-match-wins routing engine posts build outcomes to Slack channels via
|
|
5
|
+
`chat.postMessage`. Channels are addressed by ID so channel renames do not
|
|
6
|
+
break routing. Works with any CI system; GitHub Actions gets sensible
|
|
7
|
+
defaults out of the box.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Add this line to your application's Gemfile:
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
gem 'rake_slack'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
And then execute:
|
|
18
|
+
|
|
19
|
+
$ bundle
|
|
20
|
+
|
|
21
|
+
Or install it yourself as:
|
|
22
|
+
|
|
23
|
+
$ gem install rake_slack
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Define the notification task in your `Rakefile`, wrapping it in a namespace and
|
|
28
|
+
passing the routing table your project needs:
|
|
29
|
+
|
|
30
|
+
```ruby
|
|
31
|
+
require 'rake_slack'
|
|
32
|
+
|
|
33
|
+
namespace :slack do
|
|
34
|
+
RakeSlack.define_notification_tasks do |t|
|
|
35
|
+
t.bot_token = ENV.fetch('SLACK_BOT_TOKEN', nil)
|
|
36
|
+
|
|
37
|
+
# Ordered; first match wins. A rule matches when every key in its `when`
|
|
38
|
+
# equals the corresponding task value (outcome is lowercased first).
|
|
39
|
+
# `when: {}` is the catch-all default.
|
|
40
|
+
t.routing_rules = [
|
|
41
|
+
{ when: { type: 'on_hold' },
|
|
42
|
+
channel: 'C038EDCRSQJ', format: :on_hold },
|
|
43
|
+
{ when: { actor: 'dependabot[bot]', outcome: 'success' },
|
|
44
|
+
channel: 'C03N711HVDG', format: :success },
|
|
45
|
+
{ when: { actor: 'dependabot[bot]' },
|
|
46
|
+
channel: 'C03N711HVDG', format: :failure },
|
|
47
|
+
{ when: { outcome: 'success' },
|
|
48
|
+
channel: 'C023XUE76GH', format: :success },
|
|
49
|
+
{ when: {},
|
|
50
|
+
channel: 'C01TVGGB0F6', format: :failure }
|
|
51
|
+
]
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
This defines `slack:notify[outcome,type]`. `outcome` is the first bracket
|
|
57
|
+
argument (typically the job status); `type` is an optional second argument
|
|
58
|
+
(`build` by default, or `on_hold` for the release approval ping).
|
|
59
|
+
|
|
60
|
+
The ambient build context (`repository`, `workflow`, `branch`, `actor` and
|
|
61
|
+
`run_url`) defaults to the GitHub Actions environment variables
|
|
62
|
+
(`GITHUB_REPOSITORY`, `GITHUB_WORKFLOW`, `GITHUB_REF_NAME`, `GITHUB_ACTOR`,
|
|
63
|
+
`GITHUB_SERVER_URL`/`GITHUB_RUN_ID`), but each is an ordinary task parameter —
|
|
64
|
+
on any other CI system, set them explicitly in the configuration block from
|
|
65
|
+
that system's environment.
|
|
66
|
+
|
|
67
|
+
Invoke it from the command line:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
bundle exec rake "slack:notify[success]" # route on a success outcome
|
|
71
|
+
bundle exec rake "slack:notify[failure]" # route on a failure outcome
|
|
72
|
+
bundle exec rake "slack:notify[success,on_hold]" # release on-hold ping
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Routing behaviour
|
|
76
|
+
|
|
77
|
+
- `cancelled`, `canceled` and `skipped` outcomes are silent (no message is
|
|
78
|
+
posted). Override the set with `t.silent_outcomes`.
|
|
79
|
+
- The outcome is lowercased before matching.
|
|
80
|
+
- `fail_on_error` defaults to `false`, so Slack API or network failures are
|
|
81
|
+
logged rather than raised — pipelines never break on Slack outages. Set it to
|
|
82
|
+
`true` to fail the task on a delivery error.
|
|
83
|
+
- The colour, emoji and status word for each `format` key (`:success`,
|
|
84
|
+
`:failure`, `:on_hold`) can be overridden via `t.formats`.
|
|
85
|
+
|
|
86
|
+
### GitHub Actions example
|
|
87
|
+
|
|
88
|
+
Post an outcome from a workflow job (the token comes from a repository secret):
|
|
89
|
+
|
|
90
|
+
```yaml
|
|
91
|
+
- name: Notify Slack
|
|
92
|
+
if: always()
|
|
93
|
+
run: bundle exec rake "slack:notify[${{ job.status }}]"
|
|
94
|
+
env:
|
|
95
|
+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The bot token must be an `xoxb-...` token with the `chat:write` scope, and the
|
|
99
|
+
bot must be a member of every target channel.
|
|
100
|
+
|
|
101
|
+
## Development
|
|
102
|
+
|
|
103
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
104
|
+
`bundle exec rake test:unit` to run the tests. You can also run `bin/console`
|
|
105
|
+
for an interactive prompt that will allow you to experiment.
|
|
106
|
+
|
|
107
|
+
To release a new version, run `bundle exec rake "version:bump[minor]"` (or
|
|
108
|
+
`major`/`patch`/`pre`) and then `bundle exec rake release`, which will create a
|
|
109
|
+
git tag for the version, push git commits and tags, and push the `.gem` file to
|
|
110
|
+
[rubygems.org](https://rubygems.org).
|
|
111
|
+
|
|
112
|
+
## Contributing
|
|
113
|
+
|
|
114
|
+
Bug reports and pull requests are welcome on GitHub at
|
|
115
|
+
https://github.com/infrablocks/rake_slack. This project is intended to be a
|
|
116
|
+
safe, welcoming space for collaboration, and contributors are expected to
|
|
117
|
+
adhere to the [Contributor Covenant](http://contributor-covenant.org) code of
|
|
118
|
+
conduct.
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
The gem is available as open source under the terms of the
|
|
123
|
+
[MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'rake_git'
|
|
4
|
+
require 'rake_git_crypt'
|
|
5
|
+
require 'rake_github'
|
|
6
|
+
require 'rake_gpg'
|
|
7
|
+
require 'rake_ssh'
|
|
8
|
+
require 'rspec/core/rake_task'
|
|
9
|
+
require 'rubocop/rake_task'
|
|
10
|
+
require 'securerandom'
|
|
11
|
+
require 'yaml'
|
|
12
|
+
|
|
13
|
+
require 'rake_slack'
|
|
14
|
+
|
|
15
|
+
task default: %i[
|
|
16
|
+
library:fix
|
|
17
|
+
test:unit
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
RakeGitCrypt.define_standard_tasks(
|
|
21
|
+
namespace: :git_crypt,
|
|
22
|
+
|
|
23
|
+
provision_secrets_task_name: :'secrets:provision',
|
|
24
|
+
destroy_secrets_task_name: :'secrets:destroy',
|
|
25
|
+
|
|
26
|
+
install_commit_task_name: :'git:commit',
|
|
27
|
+
uninstall_commit_task_name: :'git:commit',
|
|
28
|
+
|
|
29
|
+
gpg_user_key_paths: %w[
|
|
30
|
+
config/gpg
|
|
31
|
+
config/secrets/ci/gpg.public
|
|
32
|
+
]
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
namespace :git do
|
|
36
|
+
RakeGit.define_commit_task(
|
|
37
|
+
argument_names: [:message]
|
|
38
|
+
) do |t, args|
|
|
39
|
+
t.message = args.message
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
namespace :encryption do
|
|
44
|
+
namespace :directory do
|
|
45
|
+
desc 'Ensure CI secrets directory exists.'
|
|
46
|
+
task :ensure do
|
|
47
|
+
FileUtils.mkdir_p('config/secrets/ci')
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
namespace :passphrase do
|
|
52
|
+
desc 'Generate encryption passphrase for CI GPG key'
|
|
53
|
+
task generate: ['directory:ensure'] do
|
|
54
|
+
File.write(
|
|
55
|
+
'config/secrets/ci/encryption.passphrase',
|
|
56
|
+
SecureRandom.base64(36)
|
|
57
|
+
)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
namespace :keys do
|
|
63
|
+
namespace :gpg do
|
|
64
|
+
RakeGPG.define_generate_key_task(
|
|
65
|
+
output_directory: 'config/secrets/ci',
|
|
66
|
+
name_prefix: 'gpg',
|
|
67
|
+
owner_name: 'InfraBlocks Maintainers',
|
|
68
|
+
owner_email: 'maintainers@infrablocks.io',
|
|
69
|
+
owner_comment: 'rake_slack CI Key'
|
|
70
|
+
)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
namespace :secrets do
|
|
75
|
+
namespace :directory do
|
|
76
|
+
desc 'Ensure secrets directory exists and is set up correctly'
|
|
77
|
+
task :ensure do
|
|
78
|
+
FileUtils.mkdir_p('config/secrets')
|
|
79
|
+
unless File.exist?('config/secrets/.unlocked')
|
|
80
|
+
File.write('config/secrets/.unlocked', 'true')
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
desc 'Generate all generatable secrets.'
|
|
86
|
+
task generate: %w[
|
|
87
|
+
encryption:passphrase:generate
|
|
88
|
+
keys:gpg:generate
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
desc 'Provision all secrets.'
|
|
92
|
+
task provision: [:generate]
|
|
93
|
+
|
|
94
|
+
desc 'Delete all secrets.'
|
|
95
|
+
task :destroy do
|
|
96
|
+
rm_rf 'config/secrets'
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
desc 'Rotate all secrets.'
|
|
100
|
+
task rotate: [:'git_crypt:reinstall']
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
RuboCop::RakeTask.new
|
|
104
|
+
|
|
105
|
+
namespace :library do
|
|
106
|
+
desc 'Run all checks of the library'
|
|
107
|
+
task check: [:rubocop]
|
|
108
|
+
|
|
109
|
+
desc 'Attempt to automatically fix issues with the library'
|
|
110
|
+
task fix: [:'rubocop:autocorrect_all']
|
|
111
|
+
|
|
112
|
+
desc 'Build the library'
|
|
113
|
+
task :build do
|
|
114
|
+
sh 'gem build rake_slack.gemspec'
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
namespace :test do
|
|
119
|
+
RSpec::Core::RakeTask.new(:unit)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Self-provision this gem's own GitHub secrets and release environment. The
|
|
123
|
+
# configuration block reads config/secrets/github/config.yaml lazily (only when
|
|
124
|
+
# a github:* task is invoked), so defining these tasks never reads the file.
|
|
125
|
+
RakeGithub.define_repository_tasks(
|
|
126
|
+
namespace: :github,
|
|
127
|
+
repository: 'infrablocks/rake_slack'
|
|
128
|
+
) do |t|
|
|
129
|
+
github_config =
|
|
130
|
+
YAML.load_file('config/secrets/github/config.yaml')
|
|
131
|
+
rubygems_api_key =
|
|
132
|
+
File.read('config/secrets/rubygems/api_key').chomp
|
|
133
|
+
|
|
134
|
+
t.access_token = github_config['github_personal_access_token']
|
|
135
|
+
t.secrets = [
|
|
136
|
+
{ name: 'SLACK_BOT_TOKEN',
|
|
137
|
+
value: github_config['slack_bot_token'] },
|
|
138
|
+
{ name: 'RUBYGEMS_API_KEY',
|
|
139
|
+
value: rubygems_api_key }
|
|
140
|
+
]
|
|
141
|
+
t.environments = [{ name: 'release' }]
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Dogfood the gem's own Slack notifications. Channels are addressed by ID so
|
|
145
|
+
# renames do not break routing. NOTIFY_ACTOR overrides the actor for the test
|
|
146
|
+
# workflow because GitHub Actions cannot override GITHUB_ACTOR.
|
|
147
|
+
namespace :slack do
|
|
148
|
+
RakeSlack.define_notification_tasks do |t|
|
|
149
|
+
t.bot_token = ENV.fetch('SLACK_BOT_TOKEN', nil)
|
|
150
|
+
notify_actor = ENV.fetch('NOTIFY_ACTOR', nil)
|
|
151
|
+
t.actor = notify_actor if notify_actor
|
|
152
|
+
notify_fail = ENV.fetch('NOTIFY_FAIL_ON_ERROR', nil)
|
|
153
|
+
t.fail_on_error = notify_fail == 'true' unless notify_fail.nil?
|
|
154
|
+
t.routing_rules = [
|
|
155
|
+
{ when: { type: 'on_hold' },
|
|
156
|
+
channel: 'C038EDCRSQJ', format: :on_hold },
|
|
157
|
+
{ when: { actor: 'dependabot[bot]', outcome: 'success' },
|
|
158
|
+
channel: 'C03N711HVDG', format: :success },
|
|
159
|
+
{ when: { actor: 'dependabot[bot]' },
|
|
160
|
+
channel: 'C03N711HVDG', format: :failure },
|
|
161
|
+
{ when: { outcome: 'success' },
|
|
162
|
+
channel: 'C023XUE76GH', format: :success },
|
|
163
|
+
{ when: {},
|
|
164
|
+
channel: 'C01TVGGB0F6', format: :failure }
|
|
165
|
+
]
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
namespace :repository do
|
|
170
|
+
desc 'Set the git author for CI'
|
|
171
|
+
task :set_ci_author do
|
|
172
|
+
sh 'git config --global user.name "InfraBlocks CI"'
|
|
173
|
+
sh 'git config --global user.email "ci@infrablocks.com"'
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
namespace :version do
|
|
178
|
+
desc 'Bump version for specified type (pre, major, minor, patch)'
|
|
179
|
+
task :bump, [:type] do |_, args|
|
|
180
|
+
bump_version_for(args.type)
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
desc 'Release gem'
|
|
185
|
+
task :release do
|
|
186
|
+
sh 'gem release --tag --push'
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
def bump_version_for(version_type)
|
|
190
|
+
sh "gem bump --version #{version_type} " \
|
|
191
|
+
'&& bundle install ' \
|
|
192
|
+
'&& export LAST_MESSAGE="$(git log -1 --pretty=%B)" ' \
|
|
193
|
+
'&& git commit -a --amend -m "${LAST_MESSAGE} [ci skip]"'
|
|
194
|
+
end
|
data/bin/console
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require 'bundler/setup'
|
|
5
|
+
require 'rake_slack'
|
|
6
|
+
|
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
9
|
+
|
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
11
|
+
# require "pry"
|
|
12
|
+
# Pry.start
|
|
13
|
+
|
|
14
|
+
require 'irb'
|
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'json'
|
|
4
|
+
require 'excon'
|
|
5
|
+
|
|
6
|
+
require_relative 'exceptions'
|
|
7
|
+
|
|
8
|
+
module RakeSlack
|
|
9
|
+
class Client
|
|
10
|
+
URL = 'https://slack.com/api/chat.postMessage'
|
|
11
|
+
|
|
12
|
+
def initialize(bot_token)
|
|
13
|
+
@bot_token = bot_token
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def post_message(payload)
|
|
17
|
+
assert_ok(execute_post(payload))
|
|
18
|
+
rescue Excon::Error, SystemCallError, JSON::ParserError => e
|
|
19
|
+
raise RakeSlack::Exceptions::DeliveryFailed,
|
|
20
|
+
"Slack chat.postMessage failed: #{e.message}"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def execute_post(payload)
|
|
26
|
+
Excon.post(URL, headers:, body: JSON.dump(payload))
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def headers
|
|
30
|
+
{
|
|
31
|
+
'Authorization' => "Bearer #{@bot_token}",
|
|
32
|
+
'Content-Type' => 'application/json; charset=utf-8'
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def assert_ok(response)
|
|
37
|
+
unless response.status == 200
|
|
38
|
+
raise RakeSlack::Exceptions::DeliveryFailed,
|
|
39
|
+
"Slack chat.postMessage failed: #{response.status}"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
body = JSON.parse(response.body)
|
|
43
|
+
unless body['ok']
|
|
44
|
+
raise RakeSlack::Exceptions::DeliveryFailed,
|
|
45
|
+
"Slack chat.postMessage failed: #{body['error']}"
|
|
46
|
+
end
|
|
47
|
+
body
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RakeSlack
|
|
4
|
+
module Exceptions
|
|
5
|
+
class NoMatchingRule < StandardError
|
|
6
|
+
def initialize(candidate)
|
|
7
|
+
super(
|
|
8
|
+
"No routing rule matches #{candidate.inspect}. Add a catch-all " \
|
|
9
|
+
'rule (when: {}) to the end of routing_rules.'
|
|
10
|
+
)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'rake_factory'
|
|
4
|
+
|
|
5
|
+
require_relative '../client'
|
|
6
|
+
|
|
7
|
+
module RakeSlack
|
|
8
|
+
module Tasks
|
|
9
|
+
class Notify < RakeFactory::Task
|
|
10
|
+
default_name :notify
|
|
11
|
+
default_description 'Post a CI build outcome to Slack.'
|
|
12
|
+
default_argument_names %i[outcome type]
|
|
13
|
+
|
|
14
|
+
parameter :bot_token, required: true
|
|
15
|
+
parameter :routing_rules, required: true
|
|
16
|
+
|
|
17
|
+
parameter :silent_outcomes, default: %w[cancelled canceled skipped]
|
|
18
|
+
parameter :fail_on_error, default: false
|
|
19
|
+
|
|
20
|
+
parameter :actor, default: RakeFactory::DynamicValue.new {
|
|
21
|
+
ENV.fetch('GITHUB_ACTOR', nil)
|
|
22
|
+
}
|
|
23
|
+
parameter :type, default: 'build'
|
|
24
|
+
parameter :repository, default: RakeFactory::DynamicValue.new {
|
|
25
|
+
ENV.fetch('GITHUB_REPOSITORY', nil)
|
|
26
|
+
}
|
|
27
|
+
parameter :workflow, default: RakeFactory::DynamicValue.new {
|
|
28
|
+
ENV.fetch('GITHUB_WORKFLOW', nil)
|
|
29
|
+
}
|
|
30
|
+
parameter :branch, default: RakeFactory::DynamicValue.new {
|
|
31
|
+
ENV.fetch('GITHUB_REF_NAME', nil)
|
|
32
|
+
}
|
|
33
|
+
parameter :run_url, default: RakeFactory::DynamicValue.new {
|
|
34
|
+
server = ENV.fetch('GITHUB_SERVER_URL', nil)
|
|
35
|
+
repository = ENV.fetch('GITHUB_REPOSITORY', nil)
|
|
36
|
+
run_id = ENV.fetch('GITHUB_RUN_ID', nil)
|
|
37
|
+
"#{server}/#{repository}/actions/runs/#{run_id}"
|
|
38
|
+
}
|
|
39
|
+
parameter :context, default: ''
|
|
40
|
+
|
|
41
|
+
parameter :formats, default: {
|
|
42
|
+
success: { colour: '#2eb67d', emoji: '✅', status_word: 'succeeded' },
|
|
43
|
+
failure: { colour: '#e01e5a', emoji: '❌', status_word: 'failed' },
|
|
44
|
+
on_hold: { colour: '#ecb22e', emoji: '⏸️',
|
|
45
|
+
status_word: 'awaiting approval' }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
action do |t, args|
|
|
49
|
+
outcome = resolve_outcome(args)
|
|
50
|
+
|
|
51
|
+
if t.silent_outcomes.include?(outcome)
|
|
52
|
+
log_silent(outcome)
|
|
53
|
+
else
|
|
54
|
+
post(t, outcome, args.type || t.type)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
private
|
|
59
|
+
|
|
60
|
+
def resolve_outcome(args)
|
|
61
|
+
outcome = args.outcome
|
|
62
|
+
if outcome.nil? || outcome.to_s.empty?
|
|
63
|
+
raise RakeFactory::RequiredParameterUnset,
|
|
64
|
+
'Required argument outcome unset.'
|
|
65
|
+
end
|
|
66
|
+
outcome.to_s.downcase
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def post(task, outcome, type)
|
|
70
|
+
rule = route(task, outcome, type)
|
|
71
|
+
format = task.formats[rule[:format]]
|
|
72
|
+
payload = build_payload(task, rule[:channel], format, outcome)
|
|
73
|
+
|
|
74
|
+
deliver(task, payload)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def deliver(task, payload)
|
|
78
|
+
RakeSlack::Client.new(task.bot_token).post_message(payload)
|
|
79
|
+
rescue RakeSlack::Exceptions::DeliveryFailed => e
|
|
80
|
+
raise e if task.fail_on_error
|
|
81
|
+
|
|
82
|
+
# rubocop:disable Style/StderrPuts
|
|
83
|
+
$stderr.puts(e.message)
|
|
84
|
+
# rubocop:enable Style/StderrPuts
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# A routing miss is a config error: raises regardless of fail_on_error.
|
|
88
|
+
def route(task, outcome, type)
|
|
89
|
+
candidate = { outcome:, actor: task.actor, type: }
|
|
90
|
+
rule = task.routing_rules.find do |r|
|
|
91
|
+
r[:when].all? { |key, value| candidate[key] == value }
|
|
92
|
+
end
|
|
93
|
+
raise RakeSlack::Exceptions::NoMatchingRule, candidate unless rule
|
|
94
|
+
|
|
95
|
+
rule
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def build_payload(task, channel, format, _outcome)
|
|
99
|
+
{
|
|
100
|
+
channel:,
|
|
101
|
+
text: summary(task, format),
|
|
102
|
+
attachments: [
|
|
103
|
+
{ color: format[:colour],
|
|
104
|
+
blocks: [{ type: 'section',
|
|
105
|
+
text: { type: 'mrkdwn',
|
|
106
|
+
text: message(task, format) } }] }
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def summary(task, format)
|
|
112
|
+
"#{format[:emoji]} #{task.repository} " \
|
|
113
|
+
"#{format[:status_word]} (#{task.workflow})"
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def message(task, format)
|
|
117
|
+
base =
|
|
118
|
+
"#{format[:emoji]} *<#{task.run_url}|#{task.repository}>* " \
|
|
119
|
+
"#{format[:status_word]}\n" \
|
|
120
|
+
"*Workflow:* #{task.workflow} *Branch:* `#{task.branch}` " \
|
|
121
|
+
"*Actor:* #{task.actor}"
|
|
122
|
+
task.context.to_s.empty? ? base : "#{base}\n#{task.context}"
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def log_silent(outcome)
|
|
126
|
+
# rubocop:disable Style/StderrPuts
|
|
127
|
+
$stderr.puts("Outcome '#{outcome}' is silent; skipping " \
|
|
128
|
+
'Slack notification.')
|
|
129
|
+
# rubocop:enable Style/StderrPuts
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
data/lib/rake_slack.rb
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'rake_slack/version'
|
|
4
|
+
require 'rake_slack/exceptions'
|
|
5
|
+
require 'rake_slack/client'
|
|
6
|
+
require 'rake_slack/tasks'
|
|
7
|
+
|
|
8
|
+
module RakeSlack
|
|
9
|
+
def self.define_notification_tasks(opts = {}, &)
|
|
10
|
+
RakeSlack::Tasks::Notify.define(opts, &)
|
|
11
|
+
end
|
|
12
|
+
end
|
data/rake_slack.gemspec
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
+
require 'rake_slack/version'
|
|
6
|
+
|
|
7
|
+
files = %w[
|
|
8
|
+
bin
|
|
9
|
+
lib
|
|
10
|
+
CODE_OF_CONDUCT.md
|
|
11
|
+
rake_slack.gemspec
|
|
12
|
+
Gemfile
|
|
13
|
+
LICENSE.txt
|
|
14
|
+
Rakefile
|
|
15
|
+
README.md
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
Gem::Specification.new do |spec|
|
|
19
|
+
spec.name = 'rake_slack'
|
|
20
|
+
spec.version = RakeSlack::VERSION
|
|
21
|
+
spec.authors = ['InfraBlocks Maintainers']
|
|
22
|
+
spec.email = ['maintainers@infrablocks.io']
|
|
23
|
+
|
|
24
|
+
spec.summary = 'Rake tasks for posting CI build outcomes to Slack.'
|
|
25
|
+
spec.description = 'A configurable routing engine that posts CI build ' \
|
|
26
|
+
'outcomes to Slack channels via chat.postMessage, ' \
|
|
27
|
+
'with GitHub Actions-friendly defaults.'
|
|
28
|
+
spec.homepage = 'https://github.com/infrablocks/rake_slack'
|
|
29
|
+
spec.license = 'MIT'
|
|
30
|
+
|
|
31
|
+
spec.files = `git ls-files -z`.split("\x0").select do |f|
|
|
32
|
+
f.match(/^(#{files.map { |g| Regexp.escape(g) }.join('|')})/)
|
|
33
|
+
end
|
|
34
|
+
spec.bindir = 'exe'
|
|
35
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
36
|
+
spec.require_paths = ['lib']
|
|
37
|
+
|
|
38
|
+
spec.required_ruby_version = '>= 3.1'
|
|
39
|
+
|
|
40
|
+
spec.add_dependency 'excon', '>= 0.72', '< 2.0'
|
|
41
|
+
spec.add_dependency 'rake_factory', '~> 0.33'
|
|
42
|
+
|
|
43
|
+
spec.add_development_dependency 'activesupport'
|
|
44
|
+
spec.add_development_dependency 'bundler'
|
|
45
|
+
spec.add_development_dependency 'gem-release'
|
|
46
|
+
spec.add_development_dependency 'rake'
|
|
47
|
+
spec.add_development_dependency 'rake_git'
|
|
48
|
+
spec.add_development_dependency 'rake_git_crypt'
|
|
49
|
+
spec.add_development_dependency 'rake_github'
|
|
50
|
+
spec.add_development_dependency 'rake_gpg'
|
|
51
|
+
spec.add_development_dependency 'rake_ssh'
|
|
52
|
+
spec.add_development_dependency 'rspec'
|
|
53
|
+
spec.add_development_dependency 'rubocop'
|
|
54
|
+
spec.add_development_dependency 'rubocop-rake'
|
|
55
|
+
spec.add_development_dependency 'rubocop-rspec'
|
|
56
|
+
spec.add_development_dependency 'simplecov'
|
|
57
|
+
|
|
58
|
+
spec.metadata['rubygems_mfa_required'] = 'false'
|
|
59
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: rake_slack
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.2.0.pre.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- InfraBlocks Maintainers
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-07-09 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: excon
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0.72'
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '2.0'
|
|
23
|
+
type: :runtime
|
|
24
|
+
prerelease: false
|
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
+
requirements:
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '0.72'
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '2.0'
|
|
33
|
+
- !ruby/object:Gem::Dependency
|
|
34
|
+
name: rake_factory
|
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0.33'
|
|
40
|
+
type: :runtime
|
|
41
|
+
prerelease: false
|
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0.33'
|
|
47
|
+
- !ruby/object:Gem::Dependency
|
|
48
|
+
name: activesupport
|
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
54
|
+
type: :development
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0'
|
|
61
|
+
- !ruby/object:Gem::Dependency
|
|
62
|
+
name: bundler
|
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0'
|
|
68
|
+
type: :development
|
|
69
|
+
prerelease: false
|
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0'
|
|
75
|
+
- !ruby/object:Gem::Dependency
|
|
76
|
+
name: gem-release
|
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0'
|
|
82
|
+
type: :development
|
|
83
|
+
prerelease: false
|
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '0'
|
|
89
|
+
- !ruby/object:Gem::Dependency
|
|
90
|
+
name: rake
|
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - ">="
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '0'
|
|
96
|
+
type: :development
|
|
97
|
+
prerelease: false
|
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '0'
|
|
103
|
+
- !ruby/object:Gem::Dependency
|
|
104
|
+
name: rake_git
|
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - ">="
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: '0'
|
|
110
|
+
type: :development
|
|
111
|
+
prerelease: false
|
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - ">="
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '0'
|
|
117
|
+
- !ruby/object:Gem::Dependency
|
|
118
|
+
name: rake_git_crypt
|
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - ">="
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: '0'
|
|
124
|
+
type: :development
|
|
125
|
+
prerelease: false
|
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
127
|
+
requirements:
|
|
128
|
+
- - ">="
|
|
129
|
+
- !ruby/object:Gem::Version
|
|
130
|
+
version: '0'
|
|
131
|
+
- !ruby/object:Gem::Dependency
|
|
132
|
+
name: rake_github
|
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
|
134
|
+
requirements:
|
|
135
|
+
- - ">="
|
|
136
|
+
- !ruby/object:Gem::Version
|
|
137
|
+
version: '0'
|
|
138
|
+
type: :development
|
|
139
|
+
prerelease: false
|
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
141
|
+
requirements:
|
|
142
|
+
- - ">="
|
|
143
|
+
- !ruby/object:Gem::Version
|
|
144
|
+
version: '0'
|
|
145
|
+
- !ruby/object:Gem::Dependency
|
|
146
|
+
name: rake_gpg
|
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
|
148
|
+
requirements:
|
|
149
|
+
- - ">="
|
|
150
|
+
- !ruby/object:Gem::Version
|
|
151
|
+
version: '0'
|
|
152
|
+
type: :development
|
|
153
|
+
prerelease: false
|
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
155
|
+
requirements:
|
|
156
|
+
- - ">="
|
|
157
|
+
- !ruby/object:Gem::Version
|
|
158
|
+
version: '0'
|
|
159
|
+
- !ruby/object:Gem::Dependency
|
|
160
|
+
name: rake_ssh
|
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
|
162
|
+
requirements:
|
|
163
|
+
- - ">="
|
|
164
|
+
- !ruby/object:Gem::Version
|
|
165
|
+
version: '0'
|
|
166
|
+
type: :development
|
|
167
|
+
prerelease: false
|
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
169
|
+
requirements:
|
|
170
|
+
- - ">="
|
|
171
|
+
- !ruby/object:Gem::Version
|
|
172
|
+
version: '0'
|
|
173
|
+
- !ruby/object:Gem::Dependency
|
|
174
|
+
name: rspec
|
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
|
176
|
+
requirements:
|
|
177
|
+
- - ">="
|
|
178
|
+
- !ruby/object:Gem::Version
|
|
179
|
+
version: '0'
|
|
180
|
+
type: :development
|
|
181
|
+
prerelease: false
|
|
182
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
183
|
+
requirements:
|
|
184
|
+
- - ">="
|
|
185
|
+
- !ruby/object:Gem::Version
|
|
186
|
+
version: '0'
|
|
187
|
+
- !ruby/object:Gem::Dependency
|
|
188
|
+
name: rubocop
|
|
189
|
+
requirement: !ruby/object:Gem::Requirement
|
|
190
|
+
requirements:
|
|
191
|
+
- - ">="
|
|
192
|
+
- !ruby/object:Gem::Version
|
|
193
|
+
version: '0'
|
|
194
|
+
type: :development
|
|
195
|
+
prerelease: false
|
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
197
|
+
requirements:
|
|
198
|
+
- - ">="
|
|
199
|
+
- !ruby/object:Gem::Version
|
|
200
|
+
version: '0'
|
|
201
|
+
- !ruby/object:Gem::Dependency
|
|
202
|
+
name: rubocop-rake
|
|
203
|
+
requirement: !ruby/object:Gem::Requirement
|
|
204
|
+
requirements:
|
|
205
|
+
- - ">="
|
|
206
|
+
- !ruby/object:Gem::Version
|
|
207
|
+
version: '0'
|
|
208
|
+
type: :development
|
|
209
|
+
prerelease: false
|
|
210
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
211
|
+
requirements:
|
|
212
|
+
- - ">="
|
|
213
|
+
- !ruby/object:Gem::Version
|
|
214
|
+
version: '0'
|
|
215
|
+
- !ruby/object:Gem::Dependency
|
|
216
|
+
name: rubocop-rspec
|
|
217
|
+
requirement: !ruby/object:Gem::Requirement
|
|
218
|
+
requirements:
|
|
219
|
+
- - ">="
|
|
220
|
+
- !ruby/object:Gem::Version
|
|
221
|
+
version: '0'
|
|
222
|
+
type: :development
|
|
223
|
+
prerelease: false
|
|
224
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
225
|
+
requirements:
|
|
226
|
+
- - ">="
|
|
227
|
+
- !ruby/object:Gem::Version
|
|
228
|
+
version: '0'
|
|
229
|
+
- !ruby/object:Gem::Dependency
|
|
230
|
+
name: simplecov
|
|
231
|
+
requirement: !ruby/object:Gem::Requirement
|
|
232
|
+
requirements:
|
|
233
|
+
- - ">="
|
|
234
|
+
- !ruby/object:Gem::Version
|
|
235
|
+
version: '0'
|
|
236
|
+
type: :development
|
|
237
|
+
prerelease: false
|
|
238
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
239
|
+
requirements:
|
|
240
|
+
- - ">="
|
|
241
|
+
- !ruby/object:Gem::Version
|
|
242
|
+
version: '0'
|
|
243
|
+
description: A configurable routing engine that posts CI build outcomes to Slack channels
|
|
244
|
+
via chat.postMessage, with GitHub Actions-friendly defaults.
|
|
245
|
+
email:
|
|
246
|
+
- maintainers@infrablocks.io
|
|
247
|
+
executables: []
|
|
248
|
+
extensions: []
|
|
249
|
+
extra_rdoc_files: []
|
|
250
|
+
files:
|
|
251
|
+
- CODE_OF_CONDUCT.md
|
|
252
|
+
- Gemfile
|
|
253
|
+
- Gemfile.lock
|
|
254
|
+
- LICENSE.txt
|
|
255
|
+
- README.md
|
|
256
|
+
- Rakefile
|
|
257
|
+
- bin/console
|
|
258
|
+
- bin/setup
|
|
259
|
+
- lib/rake_slack.rb
|
|
260
|
+
- lib/rake_slack/client.rb
|
|
261
|
+
- lib/rake_slack/exceptions.rb
|
|
262
|
+
- lib/rake_slack/exceptions/delivery_failed.rb
|
|
263
|
+
- lib/rake_slack/exceptions/no_matching_rule.rb
|
|
264
|
+
- lib/rake_slack/tasks.rb
|
|
265
|
+
- lib/rake_slack/tasks/notify.rb
|
|
266
|
+
- lib/rake_slack/version.rb
|
|
267
|
+
- rake_slack.gemspec
|
|
268
|
+
homepage: https://github.com/infrablocks/rake_slack
|
|
269
|
+
licenses:
|
|
270
|
+
- MIT
|
|
271
|
+
metadata:
|
|
272
|
+
rubygems_mfa_required: 'false'
|
|
273
|
+
post_install_message:
|
|
274
|
+
rdoc_options: []
|
|
275
|
+
require_paths:
|
|
276
|
+
- lib
|
|
277
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
278
|
+
requirements:
|
|
279
|
+
- - ">="
|
|
280
|
+
- !ruby/object:Gem::Version
|
|
281
|
+
version: '3.1'
|
|
282
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
283
|
+
requirements:
|
|
284
|
+
- - ">"
|
|
285
|
+
- !ruby/object:Gem::Version
|
|
286
|
+
version: 1.3.1
|
|
287
|
+
requirements: []
|
|
288
|
+
rubygems_version: 3.4.19
|
|
289
|
+
signing_key:
|
|
290
|
+
specification_version: 4
|
|
291
|
+
summary: Rake tasks for posting CI build outcomes to Slack.
|
|
292
|
+
test_files: []
|