groundskeeper-bitcore 0.14.0 → 0.19.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/.rubocop.yml +3 -0
- data/.ruby-version +1 -1
- data/README.md +3 -2
- data/bitbucket-pipelines.yml +1 -1
- data/config/git_config.rb +2 -0
- data/config/predeploy.rb +26 -5
- data/config/rails_config.rb.erb +1 -1
- data/config/vhost_config_nginx.conf.erb +26 -0
- data/groundskeeper.gemspec +2 -1
- data/lib/groundskeeper/application.rb +1 -0
- data/lib/groundskeeper/commands.rb +40 -18
- data/lib/groundskeeper/jira.rb +16 -1
- data/lib/groundskeeper/project.rb +7 -0
- data/lib/groundskeeper/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7dcfaed6f571874111c1ad58ae2bbbd584ae2d55f65310ac6440b77488f066b
|
4
|
+
data.tar.gz: 48117df263a168b70c69923bed84fd3253528c799c3115f4ef951c5822ded61a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aca1a48ad5c22b23d123d39a4d24c840100d9e31ea16c0694cae3cf983261526fae1157e9bcb198cd52c092466f8360e6d12337f2201d08356366a0055bbcf21
|
7
|
+
data.tar.gz: b2cd407005039a60bf1b034c94f85f3b53dcd624d44a47ad5682634339a2b6dace1432091bdae3a6fd9c94586bb9af624a0628f904c90d66f54974fb97616c04
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.1
|
data/README.md
CHANGED
@@ -70,10 +70,11 @@ application directory:
|
|
70
70
|
ground release
|
71
71
|
```
|
72
72
|
|
73
|
-
To prepare the server (only required the first time) for deployment
|
73
|
+
To prepare the server (only required the first time) for deployment, add nginx
|
74
|
+
flag if deploying to nginx server:
|
74
75
|
|
75
76
|
```bash
|
76
|
-
tag=0.0.0 stage=production ground predeploy
|
77
|
+
tag=0.0.0 stage=production ground predeploy [--nginx]
|
77
78
|
```
|
78
79
|
|
79
80
|
To deploy the release (note that `stage` is optional and will be set to staging
|
data/bitbucket-pipelines.yml
CHANGED
data/config/git_config.rb
CHANGED
@@ -25,6 +25,7 @@ task :before_run do
|
|
25
25
|
set :deploy_to, project.deploy_to
|
26
26
|
set :forward_agent, true
|
27
27
|
set :bundle_path, "bundle"
|
28
|
+
set :smtp_domain, project.smtp_domain
|
28
29
|
|
29
30
|
set :rvm_ruby_version, project.rvm_ruby_version
|
30
31
|
set :rvm_type, :system
|
@@ -41,5 +42,6 @@ task :before_run do
|
|
41
42
|
|
42
43
|
set :branch, "master"
|
43
44
|
set :tag, tag
|
45
|
+
set :nginx, fetch(:nginx)
|
44
46
|
end
|
45
47
|
# rubocop:enable Metrics/BlockLength
|
data/config/predeploy.rb
CHANGED
@@ -28,6 +28,14 @@ def vhost_config_file
|
|
28
28
|
"/etc/httpd/conf.d/#{fetch :application_name}.conf"
|
29
29
|
end
|
30
30
|
|
31
|
+
def vhost_nginx_config_file
|
32
|
+
"/etc/nginx/sites-available/#{fetch :application_name}.conf"
|
33
|
+
end
|
34
|
+
|
35
|
+
def vhost_nginx_linked_file
|
36
|
+
"/etc/nginx/sites-enabled/#{fetch :application_name}.conf"
|
37
|
+
end
|
38
|
+
|
31
39
|
def remote_shared_path(path)
|
32
40
|
"#{fetch(:user)}@#{fetch(:domain)}:#{fetch(:shared_path)}/#{path}"
|
33
41
|
end
|
@@ -101,14 +109,25 @@ namespace :deploy_configure do
|
|
101
109
|
end
|
102
110
|
# rubocop:enable Metrics/BlockLength
|
103
111
|
|
112
|
+
# rubocop:disable Metrics/BlockLength
|
104
113
|
namespace :deploy_prepare do
|
105
114
|
desc "Write the virtual host config file. May require an Apache restart."
|
106
115
|
task :create_vhost do
|
107
116
|
load_project
|
117
|
+
vhost_file = vhost_config_file
|
108
118
|
vhost_config = load_template("vhost_config.conf.erb")
|
109
|
-
|
110
|
-
|
111
|
-
|
119
|
+
|
120
|
+
if fetch(:nginx)
|
121
|
+
vhost_file = vhost_nginx_config_file
|
122
|
+
vhost_config = load_template("vhost_config_nginx.conf.erb")
|
123
|
+
command "sudo chown -R deploy:nginx /etc/nginx/sites-available"
|
124
|
+
command "sudo chown -R deploy:nginx /etc/nginx/sites-enabled"
|
125
|
+
end
|
126
|
+
|
127
|
+
if !(File.exist? vhost_file) || FORCE_OVERWRITE
|
128
|
+
comment "Writing virtual host config to #{vhost_file}"
|
129
|
+
command "echo \"#{vhost_config}\" > #{vhost_file}"
|
130
|
+
command "ln -s #{vhost_file} #{vhost_nginx_linked_file}" if fetch(:nginx)
|
112
131
|
end
|
113
132
|
end
|
114
133
|
|
@@ -120,7 +139,9 @@ namespace :deploy_prepare do
|
|
120
139
|
|
121
140
|
desc "Set owner."
|
122
141
|
task :set_owner do
|
123
|
-
|
124
|
-
|
142
|
+
owner = fetch(:nginx) ? "nginx" : "apache"
|
143
|
+
comment "Setting owner of #{fetch :deploy_to} #{owner}"
|
144
|
+
command "sudo chgrp -R #{owner} #{fetch :deploy_to}"
|
125
145
|
end
|
126
146
|
end
|
147
|
+
# rubocop:enable Metrics/BlockLength
|
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
|
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<% project = fetch :project -%>
|
2
|
+
server {
|
3
|
+
listen 80;
|
4
|
+
|
5
|
+
server_name <%= fetch :domain %>;
|
6
|
+
return 301 https://<%= fetch :domain -%>/;
|
7
|
+
}
|
8
|
+
|
9
|
+
server {
|
10
|
+
listen 443 ssl;
|
11
|
+
server_name <%= fetch :domain %>;
|
12
|
+
|
13
|
+
passenger_enabled on;
|
14
|
+
passenger_friendly_error_pages off;
|
15
|
+
passenger_app_env <%= fetch :stage %>;
|
16
|
+
passenger_ruby /usr/local/rvm/gems/ruby-<%= fetch :rvm_ruby_version -%>/wrappers/ruby;
|
17
|
+
passenger_min_instances 1;
|
18
|
+
passenger_base_uri /;
|
19
|
+
|
20
|
+
root <%= fetch :deploy_to -%>/current/public;
|
21
|
+
|
22
|
+
ssl_certificate <%= project.ssl_certificate_file(fetch(:stage).to_sym) %>;
|
23
|
+
ssl_certificate_key <%= project.ssl_certificate_key_file(fetch(:stage).to_sym) %>;
|
24
|
+
ssl_protocols TLSv1.2;
|
25
|
+
ssl_ciphers HIGH:!aNULL:!MD5;
|
26
|
+
}
|
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,9 +5,11 @@ 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
|
-
# rubocop:disable
|
12
|
+
# rubocop:disable Metrics/ClassLength
|
11
13
|
class Commands
|
12
14
|
RAKEFILE = File.join(
|
13
15
|
File.dirname(__FILE__), "..", "..", "config", "deploy.rb"
|
@@ -112,7 +114,6 @@ 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
|
|
@@ -137,7 +138,7 @@ 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 = {})
|
@@ -191,6 +192,7 @@ module Groundskeeper
|
|
191
192
|
cmd << " -s" if options[:simulate]
|
192
193
|
cmd << " -v" if options[:verbose]
|
193
194
|
cmd << " force_asset_precompile=true" if options[:force_asset_precompile]
|
195
|
+
cmd << " nginx=true" if options[:nginx]
|
194
196
|
run_mina cmd
|
195
197
|
end
|
196
198
|
|
@@ -209,16 +211,18 @@ module Groundskeeper
|
|
209
211
|
:bold)
|
210
212
|
latest_version = rubygems.latest_groundskeeper_version
|
211
213
|
|
212
|
-
|
213
|
-
console.say(
|
214
|
-
"Groundskeeper is outdated, please install #{latest_version}",
|
215
|
-
:red
|
216
|
-
)
|
214
|
+
return true unless SemanticVersion.new(latest_version) > VERSION
|
217
215
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
216
|
+
question = <<~TEXT.squish
|
217
|
+
Groundskeeper is outdated,
|
218
|
+
would you like the latest version installed?
|
219
|
+
TEXT
|
220
|
+
|
221
|
+
response = console.ask(question, :red, limited_to: %w[yes no])
|
222
|
+
|
223
|
+
return true if response == "no"
|
224
|
+
|
225
|
+
console.run("gem install groundskeeper-bitcore")
|
222
226
|
end
|
223
227
|
end
|
224
228
|
# rubocop:enable Metrics/MethodLength
|
@@ -280,8 +284,14 @@ module Groundskeeper
|
|
280
284
|
|
281
285
|
def add_version_to_jira_issues
|
282
286
|
issue_ids = jira.included_issues(recent_commits)
|
283
|
-
jira.add_version_to_remote_issues(
|
284
|
-
|
287
|
+
message = jira.add_version_to_remote_issues(
|
288
|
+
next_jira_version_name, issue_ids
|
289
|
+
)
|
290
|
+
if message.blank?
|
291
|
+
console.say("# added version to Jira issues #{issue_ids}", :green)
|
292
|
+
else
|
293
|
+
announce_error(message)
|
294
|
+
end
|
285
295
|
end
|
286
296
|
|
287
297
|
def create_pr
|
@@ -306,6 +316,10 @@ module Groundskeeper
|
|
306
316
|
tag.nil? ? false : git.list_tags.include?(tag)
|
307
317
|
end
|
308
318
|
|
319
|
+
def announce_error(message)
|
320
|
+
console.say("# #{message}", :red)
|
321
|
+
end
|
322
|
+
|
309
323
|
def unrecognized_tag
|
310
324
|
console.say(
|
311
325
|
"Tag not found, try again with an existing tag.",
|
@@ -374,16 +388,24 @@ module Groundskeeper
|
|
374
388
|
|
375
389
|
# rubocop:disable Metrics/MethodLength
|
376
390
|
def update_deployed_issues
|
391
|
+
tries = 0
|
392
|
+
|
377
393
|
announce_step(
|
378
394
|
"Check deployed version at #{website.uri}/#{Website::VERSION_PATH}"
|
379
395
|
)
|
380
|
-
deployed_version = website.version
|
381
396
|
|
382
|
-
|
397
|
+
begin
|
398
|
+
deployed_version = website.version
|
399
|
+
|
400
|
+
raise VersionError unless deployed_version == ENV[TAG]
|
401
|
+
|
383
402
|
console.say("# deployment successful", :green)
|
384
403
|
transition_remote_issues deployed_version
|
385
404
|
announce_in_slack deployed_version
|
386
|
-
|
405
|
+
rescue VersionError
|
406
|
+
tries += 1
|
407
|
+
sleep 5
|
408
|
+
retry if tries < 3
|
387
409
|
# :nocov:
|
388
410
|
console.say(
|
389
411
|
"something went wrong: expected version #{ENV[TAG]}, " \
|
@@ -434,5 +456,5 @@ module Groundskeeper
|
|
434
456
|
@current_step += 1
|
435
457
|
end
|
436
458
|
end
|
437
|
-
# rubocop:enable
|
459
|
+
# rubocop:enable Metrics/ClassLength
|
438
460
|
end
|
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.19.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: 2020-
|
12
|
+
date: 2020-10-09 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
|
@@ -181,6 +181,7 @@ files:
|
|
181
181
|
- config/secrets_config.yml.erb
|
182
182
|
- config/tasks.rb
|
183
183
|
- config/vhost_config.conf.erb
|
184
|
+
- config/vhost_config_nginx.conf.erb
|
184
185
|
- groundskeeper.gemspec
|
185
186
|
- lib/groundskeeper.rb
|
186
187
|
- lib/groundskeeper/application.rb
|
@@ -216,14 +217,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
216
217
|
requirements:
|
217
218
|
- - ">="
|
218
219
|
- !ruby/object:Gem::Version
|
219
|
-
version: '
|
220
|
+
version: '2.4'
|
220
221
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
221
222
|
requirements:
|
222
223
|
- - ">="
|
223
224
|
- !ruby/object:Gem::Version
|
224
225
|
version: '0'
|
225
226
|
requirements: []
|
226
|
-
rubygems_version: 3.
|
227
|
+
rubygems_version: 3.1.2
|
227
228
|
signing_key:
|
228
229
|
specification_version: 4
|
229
230
|
summary: A gem for managing releases and deployments.
|