robopigeon 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +1 -3
  4. data/.version +1 -1
  5. data/CHANGELOG.md +18 -0
  6. data/LICENSE.txt +7 -0
  7. data/README.md +34 -131
  8. data/lib/robopigeon/dsl/base.rb +8 -0
  9. data/lib/robopigeon/dsl/initial_jobs.rb +9 -0
  10. data/lib/robopigeon/dsl/job.rb +10 -0
  11. data/lib/robopigeon/dsl.rb +6 -4
  12. data/lib/robopigeon/extend/cli.rb +34 -0
  13. data/lib/robopigeon/extend/template.rb +53 -0
  14. data/lib/robopigeon/extend/templates/default/.gitignore +16 -0
  15. data/lib/robopigeon/extend/templates/default/.gitlab-ci.yml +27 -0
  16. data/lib/robopigeon/extend/templates/default/.rubocop.yml +50 -0
  17. data/lib/robopigeon/extend/templates/default/.version +1 -0
  18. data/lib/robopigeon/extend/templates/default/Gemfile +6 -0
  19. data/lib/robopigeon/extend/templates/default/README.erb.md +35 -0
  20. data/lib/robopigeon/extend/templates/default/lib/robopigeon-extension/dsl.erb.rb +39 -0
  21. data/lib/robopigeon/extend/templates/default/lib/robopigeon-extension/helper_dsl.erb.rb +18 -0
  22. data/lib/robopigeon/extend/templates/default/lib/robopigeon-extension/version.erb.rb +5 -0
  23. data/lib/robopigeon/extend/templates/default/lib/robopigeon-extension.erb.rb +25 -0
  24. data/lib/robopigeon/extend/templates/default/robopigeon-extension.erb.gemspec +41 -0
  25. data/lib/robopigeon/extend/templates/default/spec/robopigeon-extension/dsl_spec.erb.rb +33 -0
  26. data/lib/robopigeon/extend/templates/default/spec/robopigeon-extension/helper_dsl_spec.erb.rb +14 -0
  27. data/lib/robopigeon/extend/templates/default/spec/spec_helper.erb.rb +18 -0
  28. data/lib/robopigeon/extend.rb +2 -0
  29. data/lib/robopigeon/gitlab/commit.rb +31 -0
  30. data/lib/robopigeon/gitlab/commit_dsl.rb +67 -0
  31. data/lib/robopigeon/gitlab/dsl.rb +11 -7
  32. data/lib/robopigeon/gitlab.rb +2 -0
  33. data/lib/robopigeon/jenkins/client.rb +18 -0
  34. data/lib/robopigeon/jenkins/dsl.rb +98 -0
  35. data/lib/robopigeon/jenkins/job.rb +69 -0
  36. data/lib/robopigeon/jenkins.rb +22 -0
  37. data/lib/robopigeon/jira/dsl.rb +7 -10
  38. data/lib/robopigeon/jira/helper_dsl.rb +13 -0
  39. data/lib/robopigeon/resources/initial_robopigeon.rb +55 -0
  40. data/lib/robopigeon/slack/attachments_dsl.rb +2 -2
  41. data/lib/robopigeon/slack/dsl.rb +1 -7
  42. data/lib/robopigeon.rb +2 -0
  43. data/robopigeon.gemspec +19 -15
  44. data/robopigeon.rb +55 -0
  45. metadata +121 -47
  46. data/lib/robopigeon/gitlab/jira.rb +0 -0
data/robopigeon.gemspec CHANGED
@@ -6,17 +6,18 @@ Gem::Specification.new do |spec|
6
6
  spec.name = 'robopigeon'
7
7
  spec.version = RoboPigeon::VERSION
8
8
  spec.authors = ['Alex Ives']
9
- spec.email = ['alex.ives@granicus.com']
9
+ spec.email = ['alex@ives.mn']
10
+ spec.licenses = ['MIT']
10
11
 
11
12
  spec.summary = 'A set of tools for gitlab and other ci piplines'
12
- spec.description = 'Gitlab ci, jenkins, bamboo, circleci all leave something to be desired - a tigher integration with notifications and git actions. Pigeon bot is a new tool to help you craft pipelines that give you notifications and get you the functionality of a full time bot, without having to run one.'
13
- spec.homepage = 'https://gitlab.com/robopigeon/robopigeon'
13
+ spec.description = 'Gitlab ci, jenkins, bamboo, circleci all leave something to be desired - a tigher integration with notifications and git actions. RoboPigeon is a new tool to help you craft pipelines that give you notifications and get you the functionality of a full time bot, without having to run one.'
14
+ spec.homepage = 'https://gitlab.com/pigeons/robopigeon'
14
15
 
15
16
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
16
17
  # to allow pushing to a single host or delete this section to allow pushing to any host.
17
18
  if spec.respond_to?(:metadata)
18
19
  spec.metadata['homepage_uri'] = spec.homepage
19
- spec.metadata['source_code_uri'] = 'https://gitlab.com/robopigeon/robopigeon'
20
+ spec.metadata['source_code_uri'] = 'https://gitlab.com/pigeons/robopigeon'
20
21
  else
21
22
  raise 'RubyGems 2.0 or newer is required to protect against ' \
22
23
  'public gem pushes.'
@@ -31,17 +32,20 @@ Gem::Specification.new do |spec|
31
32
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
33
  spec.require_paths = ['lib']
33
34
 
34
- spec.add_dependency 'gitlab'
35
- spec.add_dependency 'markdown2confluence'
36
- spec.add_dependency 'picky'
37
- spec.add_dependency 'slack-ruby-client'
35
+ spec.add_dependency 'gitlab', '~> 4.5'
36
+ spec.add_dependency 'jenkins_api_client', '~> 1.5'
37
+ spec.add_dependency 'markdown2confluence', '~> 0.0.4'
38
+ spec.add_dependency 'picky', '~> 4.31'
39
+ spec.add_dependency 'slack-ruby-client', '~> 0.14'
38
40
  spec.add_dependency 'slackdown', '~> 0.2'
39
41
 
40
- spec.add_development_dependency 'bundler'
41
- spec.add_development_dependency 'pry'
42
- spec.add_development_dependency 'rake', '~> 10.0'
43
- spec.add_development_dependency 'rspec', '~> 3.0'
44
- spec.add_development_dependency 'rubocop'
45
- spec.add_development_dependency 'vcr'
46
- spec.add_development_dependency 'webmock'
42
+ spec.add_development_dependency 'bundler', '>= 1.15', '< 3'
43
+ spec.add_development_dependency 'bundler-audit', '~> 0.6'
44
+ spec.add_development_dependency 'pry', '~> 0.12'
45
+ spec.add_development_dependency 'rake', '~> 10.5'
46
+ spec.add_development_dependency 'rspec', '~> 3.8'
47
+ spec.add_development_dependency 'rubocop', '~> 0.57'
48
+ spec.add_development_dependency 'simplecov', '~> 0.16'
49
+ spec.add_development_dependency 'vcr', '~> 4.0'
50
+ spec.add_development_dependency 'webmock', '~> 3.5'
47
51
  end
data/robopigeon.rb CHANGED
@@ -31,6 +31,56 @@ jira do
31
31
  api_key ENV['JIRA_API_TOKEN'] # Always use an envrionment variable, don't check in secrets.
32
32
  end
33
33
 
34
+ jenkins do
35
+ # Jira is currently disabled, make sure you have a valid api token with acces to
36
+ # to your repo, then remove the following line
37
+ enabled false
38
+ # This is where you configure your global jenkins settings, like api url and api token
39
+ # always keep your api key either in an environment variable or encrypted with
40
+ # something like `encryptatron` or rails secrets.
41
+ api_url 'https://jenkins.example.com'
42
+ api_user ENV['JENKINS_USER']
43
+ api_key ENV['JENKINS_TOKEN']
44
+ end
45
+
46
+ # This job is an example of updating and tagging a new version of your project
47
+ job 'update_version', 'Used to update the version to a new one!' do
48
+ gitlab do
49
+ # Creates a commit
50
+ commit do
51
+ # Check in updated report file that helps split tests.
52
+ file 'spec/knapsack_report.json'
53
+ # Check in this version file with the contents of a new verison number
54
+ file '.version', ENV['NEW_VERSION_NUMBER']
55
+
56
+ # You can configure a message for the commit too
57
+ message "Updating version to #{ENV['NEW_VERSION_NUMBER']}"
58
+ # And the author's name and email address (also can be auto-pulled from git)
59
+ author 'Deployment Pigeon', 'pigeon@ives.dev'
60
+ # What branch to commit to
61
+ branch 'master'
62
+ end
63
+
64
+ # Now, tag that commit with the new version!
65
+ create_tag('master', ENV['NEW_VERSION_NUMBER'], "Updating version to #{ENV['NEW_VERSION_NUMBER']}")
66
+ end
67
+ end
68
+
69
+ # Here's an example job that runs something in jenkins.
70
+ job 'run_in_jenkins', 'Run a job in jenkins and make sure it passes' do
71
+ # The jenkins block takes arguments to configure an existing job, you have
72
+ # to at least specify a job name, and then everything else should be
73
+ # configured through parameters.
74
+ jenkins do
75
+ # This tells the job to run a job in jenkins named 'robopigoen-test'
76
+ name 'robopigeon-test'
77
+ # This tells it to set a parameter called 'BRANCH' to the branch from gitlab ci
78
+ param 'BRANCH', ENV['CI_COMMIT_REF_NAME']
79
+ end
80
+ # At this point the job will execute and then output the log to standard out so
81
+ # so you can keep a consistent log
82
+ end
83
+
34
84
  job 'deploy_complete', 'Notify slack and comment in gitlab that a deploy is complete' do
35
85
  # This configures a slack notification, at the end of the block it sends to
36
86
  # the users and channels in the body. Un-comment the channels and fill in the
@@ -109,11 +159,16 @@ job 'create ticket' do
109
159
  # Print out the ticket number for logging/deubgging
110
160
  puts 'Created ticket:'
111
161
  print_id
162
+
163
+ # This transitions the ticket using a transition called 'Start Work'
164
+ transition 'Start Work'
112
165
  end
113
166
  end
114
167
 
168
+ # Then it sends a notification in slack wit the link to the ticket
115
169
  slack do
116
170
  user ENV['GITLAB_USER_EMAIL']
171
+ # That helper gives you a slack formatted link for the jira ticket
117
172
  message "Created #{jira_last_created_ticket_slack_link}"
118
173
  end
119
174
  end
metadata CHANGED
@@ -1,71 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: robopigeon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Ives
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-12 00:00:00.000000000 Z
11
+ date: 2019-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '4.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '4.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: jenkins_api_client
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.5'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.5'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: markdown2confluence
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - ">="
45
+ - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '0'
47
+ version: 0.0.4
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - ">="
52
+ - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '0'
54
+ version: 0.0.4
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: picky
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - ">="
59
+ - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '0'
61
+ version: '4.31'
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - ">="
66
+ - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '0'
68
+ version: '4.31'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: slack-ruby-client
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - ">="
73
+ - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '0'
75
+ version: '0.14'
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - ">="
80
+ - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '0'
82
+ version: '0.14'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: slackdown
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -86,104 +100,138 @@ dependencies:
86
100
  requirements:
87
101
  - - ">="
88
102
  - !ruby/object:Gem::Version
89
- version: '0'
103
+ version: '1.15'
104
+ - - "<"
105
+ - !ruby/object:Gem::Version
106
+ version: '3'
90
107
  type: :development
91
108
  prerelease: false
92
109
  version_requirements: !ruby/object:Gem::Requirement
93
110
  requirements:
94
111
  - - ">="
95
112
  - !ruby/object:Gem::Version
96
- version: '0'
113
+ version: '1.15'
114
+ - - "<"
115
+ - !ruby/object:Gem::Version
116
+ version: '3'
117
+ - !ruby/object:Gem::Dependency
118
+ name: bundler-audit
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '0.6'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '0.6'
97
131
  - !ruby/object:Gem::Dependency
98
132
  name: pry
99
133
  requirement: !ruby/object:Gem::Requirement
100
134
  requirements:
101
- - - ">="
135
+ - - "~>"
102
136
  - !ruby/object:Gem::Version
103
- version: '0'
137
+ version: '0.12'
104
138
  type: :development
105
139
  prerelease: false
106
140
  version_requirements: !ruby/object:Gem::Requirement
107
141
  requirements:
108
- - - ">="
142
+ - - "~>"
109
143
  - !ruby/object:Gem::Version
110
- version: '0'
144
+ version: '0.12'
111
145
  - !ruby/object:Gem::Dependency
112
146
  name: rake
113
147
  requirement: !ruby/object:Gem::Requirement
114
148
  requirements:
115
149
  - - "~>"
116
150
  - !ruby/object:Gem::Version
117
- version: '10.0'
151
+ version: '10.5'
118
152
  type: :development
119
153
  prerelease: false
120
154
  version_requirements: !ruby/object:Gem::Requirement
121
155
  requirements:
122
156
  - - "~>"
123
157
  - !ruby/object:Gem::Version
124
- version: '10.0'
158
+ version: '10.5'
125
159
  - !ruby/object:Gem::Dependency
126
160
  name: rspec
127
161
  requirement: !ruby/object:Gem::Requirement
128
162
  requirements:
129
163
  - - "~>"
130
164
  - !ruby/object:Gem::Version
131
- version: '3.0'
165
+ version: '3.8'
132
166
  type: :development
133
167
  prerelease: false
134
168
  version_requirements: !ruby/object:Gem::Requirement
135
169
  requirements:
136
170
  - - "~>"
137
171
  - !ruby/object:Gem::Version
138
- version: '3.0'
172
+ version: '3.8'
139
173
  - !ruby/object:Gem::Dependency
140
174
  name: rubocop
141
175
  requirement: !ruby/object:Gem::Requirement
142
176
  requirements:
143
- - - ">="
177
+ - - "~>"
144
178
  - !ruby/object:Gem::Version
145
- version: '0'
179
+ version: '0.57'
146
180
  type: :development
147
181
  prerelease: false
148
182
  version_requirements: !ruby/object:Gem::Requirement
149
183
  requirements:
150
- - - ">="
184
+ - - "~>"
151
185
  - !ruby/object:Gem::Version
152
- version: '0'
186
+ version: '0.57'
187
+ - !ruby/object:Gem::Dependency
188
+ name: simplecov
189
+ requirement: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - "~>"
192
+ - !ruby/object:Gem::Version
193
+ version: '0.16'
194
+ type: :development
195
+ prerelease: false
196
+ version_requirements: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - "~>"
199
+ - !ruby/object:Gem::Version
200
+ version: '0.16'
153
201
  - !ruby/object:Gem::Dependency
154
202
  name: vcr
155
203
  requirement: !ruby/object:Gem::Requirement
156
204
  requirements:
157
- - - ">="
205
+ - - "~>"
158
206
  - !ruby/object:Gem::Version
159
- version: '0'
207
+ version: '4.0'
160
208
  type: :development
161
209
  prerelease: false
162
210
  version_requirements: !ruby/object:Gem::Requirement
163
211
  requirements:
164
- - - ">="
212
+ - - "~>"
165
213
  - !ruby/object:Gem::Version
166
- version: '0'
214
+ version: '4.0'
167
215
  - !ruby/object:Gem::Dependency
168
216
  name: webmock
169
217
  requirement: !ruby/object:Gem::Requirement
170
218
  requirements:
171
- - - ">="
219
+ - - "~>"
172
220
  - !ruby/object:Gem::Version
173
- version: '0'
221
+ version: '3.5'
174
222
  type: :development
175
223
  prerelease: false
176
224
  version_requirements: !ruby/object:Gem::Requirement
177
225
  requirements:
178
- - - ">="
226
+ - - "~>"
179
227
  - !ruby/object:Gem::Version
180
- version: '0'
228
+ version: '3.5'
181
229
  description: Gitlab ci, jenkins, bamboo, circleci all leave something to be desired
182
- - a tigher integration with notifications and git actions. Pigeon bot is a new tool
230
+ - a tigher integration with notifications and git actions. RoboPigeon is a new tool
183
231
  to help you craft pipelines that give you notifications and get you the functionality
184
232
  of a full time bot, without having to run one.
185
233
  email:
186
- - alex.ives@granicus.com
234
+ - alex@ives.mn
187
235
  executables:
188
236
  - robopigeon
189
237
  extensions: []
@@ -195,7 +243,9 @@ files:
195
243
  - ".rubocop.yml"
196
244
  - ".ruby-version"
197
245
  - ".version"
246
+ - CHANGELOG.md
198
247
  - Gemfile
248
+ - LICENSE.txt
199
249
  - README.md
200
250
  - Rakefile
201
251
  - bin/console
@@ -207,17 +257,40 @@ files:
207
257
  - lib/robopigeon.rb
208
258
  - lib/robopigeon/documentarian.rb
209
259
  - lib/robopigeon/dsl.rb
260
+ - lib/robopigeon/dsl/base.rb
210
261
  - lib/robopigeon/dsl/helpers.rb
211
262
  - lib/robopigeon/dsl/initial_jobs.rb
212
263
  - lib/robopigeon/dsl/job.rb
264
+ - lib/robopigeon/extend.rb
265
+ - lib/robopigeon/extend/cli.rb
266
+ - lib/robopigeon/extend/template.rb
267
+ - lib/robopigeon/extend/templates/default/.gitignore
268
+ - lib/robopigeon/extend/templates/default/.gitlab-ci.yml
269
+ - lib/robopigeon/extend/templates/default/.rubocop.yml
270
+ - lib/robopigeon/extend/templates/default/.version
271
+ - lib/robopigeon/extend/templates/default/Gemfile
272
+ - lib/robopigeon/extend/templates/default/README.erb.md
273
+ - lib/robopigeon/extend/templates/default/lib/robopigeon-extension.erb.rb
274
+ - lib/robopigeon/extend/templates/default/lib/robopigeon-extension/dsl.erb.rb
275
+ - lib/robopigeon/extend/templates/default/lib/robopigeon-extension/helper_dsl.erb.rb
276
+ - lib/robopigeon/extend/templates/default/lib/robopigeon-extension/version.erb.rb
277
+ - lib/robopigeon/extend/templates/default/robopigeon-extension.erb.gemspec
278
+ - lib/robopigeon/extend/templates/default/spec/robopigeon-extension/dsl_spec.erb.rb
279
+ - lib/robopigeon/extend/templates/default/spec/robopigeon-extension/helper_dsl_spec.erb.rb
280
+ - lib/robopigeon/extend/templates/default/spec/spec_helper.erb.rb
213
281
  - lib/robopigeon/git.rb
214
282
  - lib/robopigeon/git/helper_dsl.rb
215
283
  - lib/robopigeon/gitlab.rb
216
284
  - lib/robopigeon/gitlab/client.rb
285
+ - lib/robopigeon/gitlab/commit.rb
286
+ - lib/robopigeon/gitlab/commit_dsl.rb
217
287
  - lib/robopigeon/gitlab/dsl.rb
218
288
  - lib/robopigeon/gitlab/helper_dsl.rb
219
- - lib/robopigeon/gitlab/jira.rb
220
289
  - lib/robopigeon/gitlab/merge_request.rb
290
+ - lib/robopigeon/jenkins.rb
291
+ - lib/robopigeon/jenkins/client.rb
292
+ - lib/robopigeon/jenkins/dsl.rb
293
+ - lib/robopigeon/jenkins/job.rb
221
294
  - lib/robopigeon/jira.rb
222
295
  - lib/robopigeon/jira/client.rb
223
296
  - lib/robopigeon/jira/dsl.rb
@@ -237,11 +310,12 @@ files:
237
310
  - robopigeon
238
311
  - robopigeon.gemspec
239
312
  - robopigeon.rb
240
- homepage: https://gitlab.com/robopigeon/robopigeon
241
- licenses: []
313
+ homepage: https://gitlab.com/pigeons/robopigeon
314
+ licenses:
315
+ - MIT
242
316
  metadata:
243
- homepage_uri: https://gitlab.com/robopigeon/robopigeon
244
- source_code_uri: https://gitlab.com/robopigeon/robopigeon
317
+ homepage_uri: https://gitlab.com/pigeons/robopigeon
318
+ source_code_uri: https://gitlab.com/pigeons/robopigeon
245
319
  post_install_message:
246
320
  rdoc_options: []
247
321
  require_paths:
File without changes