ndr_dev_support 7.3.1 → 7.3.2
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/CHANGELOG.md +11 -0
- data/config/rubocop/ndr.yml +1 -1
- data/lib/ndr_dev_support/capistrano/deploy_secrets.rb +2 -0
- data/lib/ndr_dev_support/capistrano/ndr_model.rb +21 -4
- data/lib/ndr_dev_support/capistrano/preinstall.rb +37 -0
- data/lib/ndr_dev_support/capistrano/revision_logger.rb +1 -5
- data/lib/ndr_dev_support/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb40a54108485d9f25a6cc88323fb474f6fd1b7ba7af787939dc8270bf7ceaf2
|
4
|
+
data.tar.gz: 8120053e06f2443829e917fda979987e9b09e8c568e75781876b338dbfa53ebb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8685d5ff16b7c3ba001490bc5897647266bef21cfa94b80eaff77678953052afa9b04c4cbedd2fa5ae7652f7fcd5d08ef0f15f12107527608a5d5c601cfdcb9c
|
7
|
+
data.tar.gz: 7c9c95bb049feccf7516c49bc4e2240d43e5aadc8596cbda484163e5fa25f8e4902fd8176c38b9f1be2bee1b3776307701eb369fa0b4b0f0dfdeb189fb1cf0d5
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
*no unreleased changes*
|
3
3
|
|
4
|
+
## 7.3.2 / 2025-05-01
|
5
|
+
### Fixed
|
6
|
+
* Capistrano: Add missing `tmpdir` requirement to deploy application secrets
|
7
|
+
* Capistrano: cap deploy:setup should be safe on existing deployments
|
8
|
+
|
9
|
+
### Added
|
10
|
+
* Capistrano: add task deploy:preinstall to preinstall ruby and bundled gems
|
11
|
+
|
12
|
+
## Changed
|
13
|
+
* Drop support for Rails 6.1
|
14
|
+
|
4
15
|
## 7.3.1 / 2025-01-02
|
5
16
|
### Added
|
6
17
|
* Capistrano: deploy application secrets from a subversion or git repository
|
data/config/rubocop/ndr.yml
CHANGED
@@ -4,6 +4,7 @@ require 'rainbow'
|
|
4
4
|
require_relative 'assets'
|
5
5
|
require_relative 'deploy_secrets'
|
6
6
|
require_relative 'install_ruby'
|
7
|
+
require_relative 'preinstall'
|
7
8
|
require_relative 'restart'
|
8
9
|
require_relative 'revision_logger'
|
9
10
|
require_relative 'ruby_version'
|
@@ -53,11 +54,15 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
53
54
|
# sticky; all deployments made within it should be owned by the deployer group too. This
|
54
55
|
# means that e.g. a deployment by "bob.smith" can then be rolled back by "tom.jones".
|
55
56
|
run "mkdir -p #{deploy_to}"
|
56
|
-
|
57
|
+
# Set deployer group for everything created by this user
|
58
|
+
# run "chgrp -R deployer #{deploy_to}"
|
59
|
+
run "find #{deploy_to} -group #{fetch(:user)} -print0 |xargs -r0 chgrp -h deployer"
|
57
60
|
|
58
61
|
# The sticky group will apply automatically to new subdirectories, but
|
59
62
|
# any existing subdirectories will need it manually applying via `-R`.
|
60
|
-
run "chmod -R g+s #{deploy_to}"
|
63
|
+
# run "chmod -R g+s #{deploy_to}"
|
64
|
+
run "find #{deploy_to} -user #{fetch(:user)} -type d " \
|
65
|
+
'-not -perm -2000 -print0 |xargs -r0 chmod g+s'
|
61
66
|
end
|
62
67
|
|
63
68
|
desc 'Custom tasks to be run once, after the initial `cap setup`'
|
@@ -67,8 +72,12 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
67
72
|
run "mkdir -p #{full_path}"
|
68
73
|
|
69
74
|
# Allow the application to write into here:
|
70
|
-
run "chgrp -R #{application_group} #{full_path}"
|
71
|
-
run "chmod -R g+s #{full_path}"
|
75
|
+
# run "chgrp -R #{application_group} #{full_path}"
|
76
|
+
# run "chmod -R g+s #{full_path}"
|
77
|
+
run "find #{full_path} -user #{fetch(:user)} -not -group #{application_group} " \
|
78
|
+
"-print0 |xargs -r0 chgrp -h #{application_group}"
|
79
|
+
run "find #{full_path} -user #{fetch(:user)} -type d " \
|
80
|
+
'-not -perm -2000 -print0 |xargs -r0 chmod g+s'
|
72
81
|
end
|
73
82
|
|
74
83
|
fetch(:shared_paths, []).each do |path|
|
@@ -185,6 +194,14 @@ def target_ruby_version_for(env)
|
|
185
194
|
match ? match[:version] : raise('Unrecognized Ruby version!')
|
186
195
|
end
|
187
196
|
|
197
|
+
def log_deployment_message(msg)
|
198
|
+
name = fetch(:deployer_name, capture('id -un').chomp)
|
199
|
+
log = File.join(shared_path, 'revisions.log')
|
200
|
+
msg = "[#{Time.now}] #{name} #{msg}" # rubocop:disable Rails/TimeZone
|
201
|
+
|
202
|
+
run "(test -e #{log} || (touch #{log} && chmod 664 #{log})) && echo #{Shellwords.escape(msg)} >> #{log};"
|
203
|
+
end
|
204
|
+
|
188
205
|
def add_target(env, name, app, port, app_user, is_web_server)
|
189
206
|
desc "Deploy to #{env} service #{app_user || 'you'}@#{app}:#{port}"
|
190
207
|
task(name) do
|
@@ -0,0 +1,37 @@
|
|
1
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
2
|
+
namespace :deploy do
|
3
|
+
desc <<~DESC
|
4
|
+
Preinstall ruby and gems, then abort and rollback cleanly, leaving the
|
5
|
+
current installation unchanged.
|
6
|
+
|
7
|
+
This is particularly useful for ruby version bumps: installing the new
|
8
|
+
ruby version and all the bundled gems can take a long time.
|
9
|
+
|
10
|
+
This aborts before updating out-of-bundle gems, in case that causes
|
11
|
+
issues when restarting the currently installed version.
|
12
|
+
|
13
|
+
Usage:
|
14
|
+
cap target deploy:preinstall
|
15
|
+
DESC
|
16
|
+
task :preinstall do
|
17
|
+
# Running this task sets a flag, to make ndr_dev_support:check_preinstall abort.
|
18
|
+
# We do this in a roundabout way on Capistrano 2, because deploy:update_code
|
19
|
+
# explicitly runs deploy:finalize_update, instead of using task dependencies.
|
20
|
+
set :preinstall, true
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
namespace :ndr_dev_support do
|
25
|
+
desc 'Hook to abort capistrano installation early after preinstalling ruby and in-bundle gems'
|
26
|
+
task :check_preinstall do
|
27
|
+
next unless fetch(:preinstall, false)
|
28
|
+
|
29
|
+
log_deployment_message("preinstalled #{real_revision}")
|
30
|
+
warn Rainbow("Successful preinstall for target: #{fetch(:name)}")
|
31
|
+
abort 'Aborting after successful preinstall'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
after 'deploy:preinstall', 'deploy:update'
|
36
|
+
before 'ndr_dev_support:update_out_of_bundle_gems', 'ndr_dev_support:check_preinstall'
|
37
|
+
end
|
@@ -2,11 +2,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
2
2
|
namespace :ndr_dev_support do
|
3
3
|
desc 'Append to the log of deployments the user and revision.'
|
4
4
|
task :log_deployment, except: { no_release: true } do
|
5
|
-
|
6
|
-
log = File.join(shared_path, 'revisions.log')
|
7
|
-
msg = "[#{Time.now}] #{name} deployed #{latest_revision}"
|
8
|
-
|
9
|
-
run "(test -e #{log} || (touch #{log} && chmod 664 #{log})) && echo #{msg} >> #{log};"
|
5
|
+
log_deployment_message("deployed #{latest_revision}")
|
10
6
|
end
|
11
7
|
end
|
12
8
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ndr_dev_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.3.
|
4
|
+
version: 7.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NCRS Development Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01
|
11
|
+
date: 2025-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -412,6 +412,7 @@ files:
|
|
412
412
|
- lib/ndr_dev_support/capistrano/deploy_secrets.rb
|
413
413
|
- lib/ndr_dev_support/capistrano/install_ruby.rb
|
414
414
|
- lib/ndr_dev_support/capistrano/ndr_model.rb
|
415
|
+
- lib/ndr_dev_support/capistrano/preinstall.rb
|
415
416
|
- lib/ndr_dev_support/capistrano/restart.rb
|
416
417
|
- lib/ndr_dev_support/capistrano/revision_logger.rb
|
417
418
|
- lib/ndr_dev_support/capistrano/ruby_version.rb
|
@@ -486,7 +487,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
486
487
|
- !ruby/object:Gem::Version
|
487
488
|
version: '0'
|
488
489
|
requirements: []
|
489
|
-
rubygems_version: 3.
|
490
|
+
rubygems_version: 3.4.19
|
490
491
|
signing_key:
|
491
492
|
specification_version: 4
|
492
493
|
summary: NDR Developer Support library
|