groundskeeper-bitcore 0.15.0 → 0.20.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/.ruby-version +1 -1
- data/bitbucket-pipelines.yml +1 -1
- data/config/git_config.rb +1 -0
- data/config/rails_config.rb.erb +1 -1
- data/groundskeeper.gemspec +2 -1
- data/lib/groundskeeper/application.rb +1 -0
- data/lib/groundskeeper/commands.rb +51 -22
- data/lib/groundskeeper/jira.rb +16 -1
- data/lib/groundskeeper/project.rb +7 -0
- data/lib/groundskeeper/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c63f8d93bd57e38a1764d916553986fdf2fe2bccdade8033600cb861e35f10a
|
4
|
+
data.tar.gz: 7e22cb9cf55bcfa7e9ce2adc2782c1d2441163a3b61b09ad8018c14f553812e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e90a7e56fc9c298ca60490b75653c937110769a1f06cf4d652c4076e0d754d5ea33ddf4e687e2679400eadb4930843dfaeb1c23e8903a2aa5aadc2242d451d14
|
7
|
+
data.tar.gz: 3af293bd0c9e94dd61010c441b3b378ee8f5a4c7b93e2df1bb81d1fc641ee8e10d98eb7109cd96a7c31727810a3b87b7c26738eea965a7217e5840ae5f2fcbae
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.1
|
data/bitbucket-pipelines.yml
CHANGED
data/config/git_config.rb
CHANGED
data/config/rails_config.rb.erb
CHANGED
@@ -64,7 +64,7 @@ Rails.application.configure do
|
|
64
64
|
authentication: :plain,
|
65
65
|
address: 'smtp.mailgun.org',
|
66
66
|
port: 587,
|
67
|
-
domain: '
|
67
|
+
domain: '<%= fetch :smtp_domain %>',
|
68
68
|
user_name: ENV['mailgun_db_username'],
|
69
69
|
password: ENV['mailgun_db_password']
|
70
70
|
}
|
data/groundskeeper.gemspec
CHANGED
@@ -31,7 +31,8 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.executables = "ground"
|
32
32
|
spec.require_paths = %w[lib config]
|
33
33
|
|
34
|
-
spec.
|
34
|
+
spec.required_ruby_version = ">= 2.4"
|
35
|
+
spec.add_dependency "jira-ruby", "~> 2.0"
|
35
36
|
spec.add_dependency "mina", "~> 1.2"
|
36
37
|
spec.add_dependency "mina-whenever", "~> 1.0.1"
|
37
38
|
spec.add_dependency "thor", "~> 1.0"
|
@@ -5,6 +5,8 @@ require "mina"
|
|
5
5
|
require "pp"
|
6
6
|
require "open3"
|
7
7
|
|
8
|
+
class VersionError < StandardError; end
|
9
|
+
|
8
10
|
module Groundskeeper
|
9
11
|
# Formulas for managing releases and deployments.
|
10
12
|
# rubocop:disable Metrics/ClassLength
|
@@ -93,7 +95,7 @@ module Groundskeeper
|
|
93
95
|
# rubocop:disable Metrics/MethodLength,Metrics/AbcSize
|
94
96
|
def info(options = {})
|
95
97
|
return unrecognized_version unless version_file.exists?
|
96
|
-
return unless check_groundskeeper_version
|
98
|
+
return groundskeeper_outdated unless check_groundskeeper_version
|
97
99
|
|
98
100
|
Executable.verbose = options[:verbose]
|
99
101
|
pull_project_details
|
@@ -112,13 +114,12 @@ module Groundskeeper
|
|
112
114
|
# rubocop:enable Metrics/AbcSize
|
113
115
|
|
114
116
|
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity,
|
115
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
116
117
|
def release(options = {})
|
117
118
|
is_initial_release = !version_file.exists?
|
118
119
|
|
119
120
|
return missing_jira_credentials unless jira.credentials?
|
120
121
|
return missing_bitbucket_credentials unless bitbucket.credentials?
|
121
|
-
return unless check_groundskeeper_version
|
122
|
+
return groundskeeper_outdated unless check_groundskeeper_version
|
122
123
|
return unrecognized_version unless version_file.rails?
|
123
124
|
|
124
125
|
version_file.create_initial_version! unless version_file.exists?
|
@@ -137,12 +138,12 @@ module Groundskeeper
|
|
137
138
|
create_pr
|
138
139
|
end
|
139
140
|
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity
|
140
|
-
# rubocop:enable Metrics/MethodLength
|
141
|
+
# rubocop:enable Metrics/MethodLength
|
141
142
|
|
142
143
|
# :nocov:
|
143
144
|
def predeploy(options = {})
|
144
145
|
return unrecognized_version unless version_file.exists?
|
145
|
-
return unless check_groundskeeper_version
|
146
|
+
return groundskeeper_outdated unless check_groundskeeper_version
|
146
147
|
|
147
148
|
Executable.verbose = options[:verbose]
|
148
149
|
pull_project_details
|
@@ -159,7 +160,7 @@ module Groundskeeper
|
|
159
160
|
return missing_jira_credentials unless jira.credentials?
|
160
161
|
return missing_sentry_credentials unless sentry.credentials?
|
161
162
|
return missing_slack_credentials unless slack.credentials?
|
162
|
-
return unless check_groundskeeper_version
|
163
|
+
return groundskeeper_outdated unless check_groundskeeper_version
|
163
164
|
return unable_to_ssh unless ssh.can_connect?
|
164
165
|
|
165
166
|
Executable.verbose = options[:verbose]
|
@@ -203,26 +204,32 @@ module Groundskeeper
|
|
203
204
|
end
|
204
205
|
end
|
205
206
|
|
206
|
-
# rubocop:disable Metrics/MethodLength
|
207
207
|
def check_groundskeeper_version
|
208
208
|
@check_groundskeeper_version ||= begin
|
209
209
|
console.say("Groundskeeper version #{Groundskeeper::VERSION}\n\n",
|
210
210
|
:bold)
|
211
211
|
latest_version = rubygems.latest_groundskeeper_version
|
212
212
|
|
213
|
-
|
214
|
-
console.say(
|
215
|
-
"Groundskeeper is outdated, please install #{latest_version}",
|
216
|
-
:red
|
217
|
-
)
|
213
|
+
return true unless SemanticVersion.new(latest_version) > VERSION
|
218
214
|
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
215
|
+
return false unless install_latest_groundskeeper?
|
216
|
+
|
217
|
+
console.run("gem install groundskeeper-bitcore")
|
218
|
+
|
219
|
+
true
|
223
220
|
end
|
224
221
|
end
|
225
|
-
|
222
|
+
|
223
|
+
# :nocov:
|
224
|
+
def install_latest_groundskeeper?
|
225
|
+
question = <<~TEXT.squish
|
226
|
+
Groundskeeper is outdated,
|
227
|
+
would you like the latest version installed?
|
228
|
+
TEXT
|
229
|
+
|
230
|
+
console.ask(question, :red, limited_to: %w[yes no]) == "yes"
|
231
|
+
end
|
232
|
+
# :nocov:
|
226
233
|
|
227
234
|
def announce_latest_tag
|
228
235
|
console.say(
|
@@ -281,8 +288,14 @@ module Groundskeeper
|
|
281
288
|
|
282
289
|
def add_version_to_jira_issues
|
283
290
|
issue_ids = jira.included_issues(recent_commits)
|
284
|
-
jira.add_version_to_remote_issues(
|
285
|
-
|
291
|
+
message = jira.add_version_to_remote_issues(
|
292
|
+
next_jira_version_name, issue_ids
|
293
|
+
)
|
294
|
+
if message.blank?
|
295
|
+
console.say("# added version to Jira issues #{issue_ids}", :green)
|
296
|
+
else
|
297
|
+
announce_error(message)
|
298
|
+
end
|
286
299
|
end
|
287
300
|
|
288
301
|
def create_pr
|
@@ -307,6 +320,10 @@ module Groundskeeper
|
|
307
320
|
tag.nil? ? false : git.list_tags.include?(tag)
|
308
321
|
end
|
309
322
|
|
323
|
+
def announce_error(message)
|
324
|
+
console.say("# #{message}", :red)
|
325
|
+
end
|
326
|
+
|
310
327
|
def unrecognized_tag
|
311
328
|
console.say(
|
312
329
|
"Tag not found, try again with an existing tag.",
|
@@ -321,6 +338,10 @@ module Groundskeeper
|
|
321
338
|
)
|
322
339
|
end
|
323
340
|
|
341
|
+
def groundskeeper_outdated
|
342
|
+
console.say("Groundskeeper outdated. Install the latest version.", :red)
|
343
|
+
end
|
344
|
+
|
324
345
|
def missing_bitbucket_credentials
|
325
346
|
console.say(
|
326
347
|
"Please configure your Bitbucket environment variables.",
|
@@ -375,16 +396,24 @@ module Groundskeeper
|
|
375
396
|
|
376
397
|
# rubocop:disable Metrics/MethodLength
|
377
398
|
def update_deployed_issues
|
399
|
+
tries = 0
|
400
|
+
|
378
401
|
announce_step(
|
379
402
|
"Check deployed version at #{website.uri}/#{Website::VERSION_PATH}"
|
380
403
|
)
|
381
|
-
deployed_version = website.version
|
382
404
|
|
383
|
-
|
405
|
+
begin
|
406
|
+
deployed_version = website.version
|
407
|
+
|
408
|
+
raise VersionError unless deployed_version == ENV[TAG]
|
409
|
+
|
384
410
|
console.say("# deployment successful", :green)
|
385
411
|
transition_remote_issues deployed_version
|
386
412
|
announce_in_slack deployed_version
|
387
|
-
|
413
|
+
rescue VersionError
|
414
|
+
tries += 1
|
415
|
+
sleep 5
|
416
|
+
retry if tries < 3
|
388
417
|
# :nocov:
|
389
418
|
console.say(
|
390
419
|
"something went wrong: expected version #{ENV[TAG]}, " \
|
data/lib/groundskeeper/jira.rb
CHANGED
@@ -4,6 +4,8 @@ require "cgi"
|
|
4
4
|
require "date"
|
5
5
|
require "jira-ruby"
|
6
6
|
|
7
|
+
class IssueNotFoundError < StandardError; end
|
8
|
+
|
7
9
|
module Groundskeeper
|
8
10
|
# Wraps an interface to Jira.
|
9
11
|
class Jira
|
@@ -46,6 +48,8 @@ module Groundskeeper
|
|
46
48
|
|
47
49
|
# :nocov:
|
48
50
|
def add_version_to_issue(issue_id:, version_name:)
|
51
|
+
raise IssueNotFoundError if client.Issue.find(issue_id).nil?
|
52
|
+
|
49
53
|
client.Issue
|
50
54
|
.find(issue_id)
|
51
55
|
.save(update: { fixVersions: [{ add: { name: version_name } }] })
|
@@ -120,11 +124,22 @@ module Groundskeeper
|
|
120
124
|
client.create_version(name: name, prefix: prefix)
|
121
125
|
end
|
122
126
|
|
127
|
+
# rubocop:disable Metrics/MethodLength
|
123
128
|
def add_version_to_remote_issues(name, issue_ids)
|
129
|
+
failed_issues = []
|
124
130
|
issue_ids.each do |issue_id|
|
125
|
-
|
131
|
+
begin
|
132
|
+
client.add_version_to_issue(issue_id: issue_id, version_name: name)
|
133
|
+
rescue IssueNotFoundError
|
134
|
+
failed_issues << issue_id
|
135
|
+
next
|
136
|
+
end
|
126
137
|
end
|
138
|
+
return "" unless failed_issues.count.positive?
|
139
|
+
|
140
|
+
"Jira issue(s) not found, is #{failed_issues.join(', ')} correct?"
|
127
141
|
end
|
142
|
+
# rubocop:enable Metrics/MethodLength
|
128
143
|
|
129
144
|
def transition_remote_issues(transition_type, issue_ids)
|
130
145
|
issue_ids.each do |issue_id|
|
@@ -17,6 +17,7 @@ module Groundskeeper
|
|
17
17
|
DB_ENV_VARIABLES_KEY = "db_env_variables"
|
18
18
|
SENTRY_DSN_KEY = "sentry_dsn"
|
19
19
|
SENTRY_PROJECT_KEY = "sentry_project"
|
20
|
+
SMTP_DOMAIN = "smtp_domain"
|
20
21
|
SSL_CERTIFICATE_FILE_KEY = "SSLCertificateFile"
|
21
22
|
SSL_CERTIFICATE_CHAIN_FILE_KEY = "SSLCertificateChainFile"
|
22
23
|
SSL_CERTIFICATE_KEY_FILE_KEY = "SSLCertificateKeyFile"
|
@@ -65,6 +66,12 @@ module Groundskeeper
|
|
65
66
|
end
|
66
67
|
# :nocov:
|
67
68
|
|
69
|
+
# :nocov:
|
70
|
+
def smtp_domain
|
71
|
+
details[SMTP_DOMAIN] || ""
|
72
|
+
end
|
73
|
+
# :nocov:
|
74
|
+
|
68
75
|
# :nocov:
|
69
76
|
def rvm_ruby_version
|
70
77
|
details[RVM_RUBY_VERSION_KEY] || ""
|
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.20.1
|
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: 2020-
|
12
|
+
date: 2020-12-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jira-ruby
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '2.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '2.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: mina
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -217,14 +217,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
217
217
|
requirements:
|
218
218
|
- - ">="
|
219
219
|
- !ruby/object:Gem::Version
|
220
|
-
version: '
|
220
|
+
version: '2.4'
|
221
221
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
222
222
|
requirements:
|
223
223
|
- - ">="
|
224
224
|
- !ruby/object:Gem::Version
|
225
225
|
version: '0'
|
226
226
|
requirements: []
|
227
|
-
rubygems_version: 3.
|
227
|
+
rubygems_version: 3.1.2
|
228
228
|
signing_key:
|
229
229
|
specification_version: 4
|
230
230
|
summary: A gem for managing releases and deployments.
|