capistrano 3.17.0 → 3.20.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/.docker/Dockerfile +7 -0
- data/.docker/ssh_key_rsa +49 -0
- data/.docker/ssh_key_rsa.pub +1 -0
- data/.docker/ubuntu_setup.sh +23 -0
- data/.github/dependabot.yml +20 -0
- data/.github/release-drafter.yml +10 -2
- data/.github/workflows/ci.yml +69 -0
- data/.github/workflows/release-drafter.yml +18 -0
- data/.rubocop.yml +23 -12
- data/.rubocop_todo.yml +257 -0
- data/DEVELOPMENT.md +4 -19
- data/Gemfile +4 -41
- data/README.md +2 -2
- data/Rakefile +6 -2
- data/capistrano.gemspec +1 -1
- data/docker-compose.yml +8 -0
- data/features/deploy.feature +5 -1
- data/features/sshconnect.feature +1 -1
- data/features/step_definitions/assertions.rb +33 -23
- data/features/step_definitions/setup.rb +10 -13
- data/features/support/docker_gateway.rb +53 -0
- data/features/support/env.rb +0 -10
- data/features/support/remote_command_helpers.rb +3 -3
- data/features/support/remote_ssh_helpers.rb +33 -0
- data/gemfiles/legacy.gemfile +7 -0
- data/lib/capistrano/configuration/server.rb +0 -2
- data/lib/capistrano/configuration/validated_variables.rb +1 -1
- data/lib/capistrano/configuration.rb +1 -1
- data/lib/capistrano/scm/git.rb +6 -0
- data/lib/capistrano/scm/tasks/git.rake +11 -0
- data/lib/capistrano/tasks/deploy.rake +23 -1
- data/lib/capistrano/templates/deploy.rb.erb +1 -1
- data/lib/capistrano/version.rb +1 -1
- data/spec/integration/dsl_spec.rb +11 -11
- data/spec/lib/capistrano/configuration/scm_resolver_spec.rb +1 -0
- data/spec/lib/capistrano/dsl_spec.rb +2 -2
- data/spec/lib/capistrano/scm/git_spec.rb +10 -0
- data/spec/support/test_app.rb +15 -12
- metadata +18 -16
- data/.circleci/config.yml +0 -113
- data/.github/workflows/push.yml +0 -12
- data/Dangerfile +0 -1
- data/features/support/vagrant_helpers.rb +0 -41
- data/spec/support/.gitignore +0 -1
- data/spec/support/Vagrantfile +0 -23
|
@@ -19,6 +19,7 @@ module Capistrano
|
|
|
19
19
|
Rake::Task.define_task("deploy:new_release_path")
|
|
20
20
|
Rake::Task.define_task("deploy:check")
|
|
21
21
|
Rake::Task.define_task("deploy:set_current_revision")
|
|
22
|
+
Rake::Task.define_task("deploy:set_current_revision_time")
|
|
22
23
|
end
|
|
23
24
|
|
|
24
25
|
# Clean up any tasks or variables that the plugin defined.
|
|
@@ -170,6 +171,15 @@ module Capistrano
|
|
|
170
171
|
end
|
|
171
172
|
end
|
|
172
173
|
|
|
174
|
+
describe "#fetch_revision_time" do
|
|
175
|
+
it "should capture git log without a pager" do
|
|
176
|
+
env.set(:branch, "branch")
|
|
177
|
+
backend.expects(:capture).with(:git, "--no-pager log -1 --pretty=format:\"%ct\" branch").returns("1715828406")
|
|
178
|
+
revision_time = subject.fetch_revision_time
|
|
179
|
+
expect(revision_time).to eq("1715828406")
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
|
|
173
183
|
describe "#verify_commit" do
|
|
174
184
|
it "should run git verify-commit" do
|
|
175
185
|
env.set(:branch, "branch")
|
data/spec/support/test_app.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require "English"
|
|
2
2
|
require "fileutils"
|
|
3
3
|
require "pathname"
|
|
4
|
+
require "open3"
|
|
4
5
|
|
|
5
6
|
module TestApp
|
|
6
7
|
extend self
|
|
@@ -12,10 +13,10 @@ module TestApp
|
|
|
12
13
|
def default_config
|
|
13
14
|
<<-CONFIG
|
|
14
15
|
set :deploy_to, '#{deploy_to}'
|
|
15
|
-
set :repo_url, '
|
|
16
|
+
set :repo_url, 'https://github.com/capistrano/capistrano.git'
|
|
16
17
|
set :branch, 'master'
|
|
17
|
-
set :ssh_options, { keys:
|
|
18
|
-
server '
|
|
18
|
+
set :ssh_options, { keys: '#{File.expand_path('../../.docker/ssh_key_rsa', __dir__)}', auth_methods: ['publickey'] }
|
|
19
|
+
server 'deployer@localhost:2022', roles: %w{web app}
|
|
19
20
|
set :linked_files, #{linked_files}
|
|
20
21
|
set :linked_dirs, #{linked_dirs}
|
|
21
22
|
set :format_options, log_file: nil
|
|
@@ -39,10 +40,13 @@ module TestApp
|
|
|
39
40
|
FileUtils.rm_rf(test_app_path)
|
|
40
41
|
FileUtils.mkdir(test_app_path)
|
|
41
42
|
|
|
42
|
-
File.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
File.write(gemfile, <<-GEMFILE.gsub(/^\s+/, ""))
|
|
44
|
+
source "https://rubygems.org"
|
|
45
|
+
|
|
46
|
+
gem "capistrano", path: #{path_to_cap.to_s.inspect}
|
|
47
|
+
gem "ed25519", ">= 1.2", "< 2.0"
|
|
48
|
+
gem "bcrypt_pbkdf", ">= 1.0", "< 2.0"
|
|
49
|
+
GEMFILE
|
|
46
50
|
|
|
47
51
|
Dir.chdir(test_app_path) do
|
|
48
52
|
run "bundle"
|
|
@@ -96,13 +100,12 @@ module TestApp
|
|
|
96
100
|
end
|
|
97
101
|
|
|
98
102
|
def run(command, subdirectory=nil)
|
|
99
|
-
output = nil
|
|
100
103
|
command = "bundle exec #{command}" unless command =~ /^bundle\b/
|
|
101
104
|
dir = subdirectory ? test_app_path.join(subdirectory) : test_app_path
|
|
102
|
-
Dir.chdir(dir) do
|
|
103
|
-
|
|
105
|
+
output, status = Dir.chdir(dir) do
|
|
106
|
+
with_clean_bundler_env { Open3.capture2e(command) }
|
|
104
107
|
end
|
|
105
|
-
[
|
|
108
|
+
[status.success?, output]
|
|
106
109
|
end
|
|
107
110
|
|
|
108
111
|
def stage
|
|
@@ -118,7 +121,7 @@ module TestApp
|
|
|
118
121
|
end
|
|
119
122
|
|
|
120
123
|
def deploy_to
|
|
121
|
-
Pathname.new("/home/
|
|
124
|
+
Pathname.new("/home/deployer/var/www/deploy")
|
|
122
125
|
end
|
|
123
126
|
|
|
124
127
|
def shared_path
|
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: capistrano
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.20.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tom Clements
|
|
8
8
|
- Lee Hambley
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: airbrussh
|
|
@@ -78,17 +77,22 @@ executables:
|
|
|
78
77
|
extensions: []
|
|
79
78
|
extra_rdoc_files: []
|
|
80
79
|
files:
|
|
81
|
-
- ".
|
|
80
|
+
- ".docker/Dockerfile"
|
|
81
|
+
- ".docker/ssh_key_rsa"
|
|
82
|
+
- ".docker/ssh_key_rsa.pub"
|
|
83
|
+
- ".docker/ubuntu_setup.sh"
|
|
84
|
+
- ".github/dependabot.yml"
|
|
82
85
|
- ".github/issue_template.md"
|
|
83
86
|
- ".github/pull_request_template.md"
|
|
84
87
|
- ".github/release-drafter.yml"
|
|
85
|
-
- ".github/workflows/
|
|
88
|
+
- ".github/workflows/ci.yml"
|
|
89
|
+
- ".github/workflows/release-drafter.yml"
|
|
86
90
|
- ".gitignore"
|
|
87
91
|
- ".rubocop.yml"
|
|
92
|
+
- ".rubocop_todo.yml"
|
|
88
93
|
- CHANGELOG.md
|
|
89
94
|
- CONTRIBUTING.md
|
|
90
95
|
- DEVELOPMENT.md
|
|
91
|
-
- Dangerfile
|
|
92
96
|
- Gemfile
|
|
93
97
|
- LICENSE.txt
|
|
94
98
|
- README.md
|
|
@@ -98,6 +102,7 @@ files:
|
|
|
98
102
|
- bin/cap
|
|
99
103
|
- bin/capify
|
|
100
104
|
- capistrano.gemspec
|
|
105
|
+
- docker-compose.yml
|
|
101
106
|
- features/configuration.feature
|
|
102
107
|
- features/deploy.feature
|
|
103
108
|
- features/deploy_failure.feature
|
|
@@ -109,9 +114,11 @@ files:
|
|
|
109
114
|
- features/step_definitions/cap_commands.rb
|
|
110
115
|
- features/step_definitions/setup.rb
|
|
111
116
|
- features/subdirectory.feature
|
|
117
|
+
- features/support/docker_gateway.rb
|
|
112
118
|
- features/support/env.rb
|
|
113
119
|
- features/support/remote_command_helpers.rb
|
|
114
|
-
- features/support/
|
|
120
|
+
- features/support/remote_ssh_helpers.rb
|
|
121
|
+
- gemfiles/legacy.gemfile
|
|
115
122
|
- lib/Capfile
|
|
116
123
|
- lib/capistrano.rb
|
|
117
124
|
- lib/capistrano/all.rb
|
|
@@ -202,8 +209,6 @@ files:
|
|
|
202
209
|
- spec/lib/capistrano/version_validator_spec.rb
|
|
203
210
|
- spec/lib/capistrano_spec.rb
|
|
204
211
|
- spec/spec_helper.rb
|
|
205
|
-
- spec/support/.gitignore
|
|
206
|
-
- spec/support/Vagrantfile
|
|
207
212
|
- spec/support/matchers.rb
|
|
208
213
|
- spec/support/tasks/database.rake
|
|
209
214
|
- spec/support/tasks/fail.rake
|
|
@@ -220,7 +225,6 @@ metadata:
|
|
|
220
225
|
source_code_uri: https://github.com/capistrano/capistrano
|
|
221
226
|
homepage_uri: https://capistranorb.com/
|
|
222
227
|
documentation_uri: https://capistranorb.com/
|
|
223
|
-
post_install_message:
|
|
224
228
|
rdoc_options: []
|
|
225
229
|
require_paths:
|
|
226
230
|
- lib
|
|
@@ -228,15 +232,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
228
232
|
requirements:
|
|
229
233
|
- - ">="
|
|
230
234
|
- !ruby/object:Gem::Version
|
|
231
|
-
version: '2.
|
|
235
|
+
version: '2.5'
|
|
232
236
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
233
237
|
requirements:
|
|
234
238
|
- - ">="
|
|
235
239
|
- !ruby/object:Gem::Version
|
|
236
240
|
version: '0'
|
|
237
241
|
requirements: []
|
|
238
|
-
rubygems_version: 3.
|
|
239
|
-
signing_key:
|
|
242
|
+
rubygems_version: 3.7.2
|
|
240
243
|
specification_version: 4
|
|
241
244
|
summary: Capistrano - Welcome to easy deployment with Ruby over SSH
|
|
242
245
|
test_files:
|
|
@@ -251,9 +254,10 @@ test_files:
|
|
|
251
254
|
- features/step_definitions/cap_commands.rb
|
|
252
255
|
- features/step_definitions/setup.rb
|
|
253
256
|
- features/subdirectory.feature
|
|
257
|
+
- features/support/docker_gateway.rb
|
|
254
258
|
- features/support/env.rb
|
|
255
259
|
- features/support/remote_command_helpers.rb
|
|
256
|
-
- features/support/
|
|
260
|
+
- features/support/remote_ssh_helpers.rb
|
|
257
261
|
- spec/integration/dsl_spec.rb
|
|
258
262
|
- spec/integration_spec_helper.rb
|
|
259
263
|
- spec/lib/capistrano/application_spec.rb
|
|
@@ -286,8 +290,6 @@ test_files:
|
|
|
286
290
|
- spec/lib/capistrano/version_validator_spec.rb
|
|
287
291
|
- spec/lib/capistrano_spec.rb
|
|
288
292
|
- spec/spec_helper.rb
|
|
289
|
-
- spec/support/.gitignore
|
|
290
|
-
- spec/support/Vagrantfile
|
|
291
293
|
- spec/support/matchers.rb
|
|
292
294
|
- spec/support/tasks/database.rake
|
|
293
295
|
- spec/support/tasks/fail.rake
|
data/.circleci/config.yml
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
version: 2.1
|
|
2
|
-
|
|
3
|
-
executors:
|
|
4
|
-
ruby:
|
|
5
|
-
parameters:
|
|
6
|
-
version:
|
|
7
|
-
description: "Ruby version number"
|
|
8
|
-
default: "3.1"
|
|
9
|
-
type: string
|
|
10
|
-
docker:
|
|
11
|
-
- image: ruby:<< parameters.version >>
|
|
12
|
-
|
|
13
|
-
commands:
|
|
14
|
-
bundle_install:
|
|
15
|
-
description: Install Ruby dependencies with Bundler
|
|
16
|
-
parameters:
|
|
17
|
-
version:
|
|
18
|
-
description: "Ruby version number"
|
|
19
|
-
default: "3.1"
|
|
20
|
-
type: string
|
|
21
|
-
steps:
|
|
22
|
-
- restore_cache:
|
|
23
|
-
keys:
|
|
24
|
-
- bundle-v1-{{ arch }}-<< parameters.version >>
|
|
25
|
-
- run:
|
|
26
|
-
name: Install Ruby Dependencies
|
|
27
|
-
command: |
|
|
28
|
-
gem install bundler --conservative --no-document || gem install bundler -v '< 2' --no-document
|
|
29
|
-
bundle config --local path vendor/bundle
|
|
30
|
-
bundle check || (bundle install --jobs=4 --retry=3 && bundle clean)
|
|
31
|
-
- save_cache:
|
|
32
|
-
paths:
|
|
33
|
-
- ./vendor/bundle
|
|
34
|
-
key: bundle-v1-{{ arch }}-<< parameters.version >>-{{ checksum "Gemfile.lock" }}
|
|
35
|
-
|
|
36
|
-
jobs:
|
|
37
|
-
danger:
|
|
38
|
-
executor: ruby
|
|
39
|
-
steps:
|
|
40
|
-
- checkout
|
|
41
|
-
- bundle_install
|
|
42
|
-
- run: bundle exec danger
|
|
43
|
-
|
|
44
|
-
rubocop:
|
|
45
|
-
executor: ruby
|
|
46
|
-
steps:
|
|
47
|
-
- checkout
|
|
48
|
-
- bundle_install
|
|
49
|
-
- run: bundle exec rubocop
|
|
50
|
-
|
|
51
|
-
spec:
|
|
52
|
-
parameters:
|
|
53
|
-
version:
|
|
54
|
-
description: "Ruby version number"
|
|
55
|
-
default: "3.1"
|
|
56
|
-
type: string
|
|
57
|
-
executor:
|
|
58
|
-
name: ruby
|
|
59
|
-
version: << parameters.version >>
|
|
60
|
-
steps:
|
|
61
|
-
- checkout
|
|
62
|
-
- bundle_install:
|
|
63
|
-
version: << parameters.version >>
|
|
64
|
-
- run: bundle exec rake spec
|
|
65
|
-
|
|
66
|
-
workflows:
|
|
67
|
-
version: 2
|
|
68
|
-
commit-workflow:
|
|
69
|
-
jobs:
|
|
70
|
-
- danger
|
|
71
|
-
- rubocop
|
|
72
|
-
- spec:
|
|
73
|
-
matrix:
|
|
74
|
-
parameters:
|
|
75
|
-
version:
|
|
76
|
-
[
|
|
77
|
-
"2.0",
|
|
78
|
-
"2.1",
|
|
79
|
-
"2.2",
|
|
80
|
-
"2.3",
|
|
81
|
-
"2.4",
|
|
82
|
-
"2.5",
|
|
83
|
-
"2.6",
|
|
84
|
-
"2.7",
|
|
85
|
-
"3.0",
|
|
86
|
-
"3.1",
|
|
87
|
-
]
|
|
88
|
-
cron-workflow:
|
|
89
|
-
jobs:
|
|
90
|
-
- rubocop
|
|
91
|
-
- spec:
|
|
92
|
-
matrix:
|
|
93
|
-
parameters:
|
|
94
|
-
version:
|
|
95
|
-
[
|
|
96
|
-
"2.0",
|
|
97
|
-
"2.1",
|
|
98
|
-
"2.2",
|
|
99
|
-
"2.3",
|
|
100
|
-
"2.4",
|
|
101
|
-
"2.5",
|
|
102
|
-
"2.6",
|
|
103
|
-
"2.7",
|
|
104
|
-
"3.0",
|
|
105
|
-
"3.1",
|
|
106
|
-
]
|
|
107
|
-
triggers:
|
|
108
|
-
- schedule:
|
|
109
|
-
cron: "0 13 * * 6"
|
|
110
|
-
filters:
|
|
111
|
-
branches:
|
|
112
|
-
only:
|
|
113
|
-
- master
|
data/.github/workflows/push.yml
DELETED
data/Dangerfile
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
danger.import_dangerfile(github: "capistrano/danger", branch: "no-changelog")
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
require "open3"
|
|
2
|
-
|
|
3
|
-
module VagrantHelpers
|
|
4
|
-
extend self
|
|
5
|
-
|
|
6
|
-
class VagrantSSHCommandError < RuntimeError; end
|
|
7
|
-
|
|
8
|
-
at_exit do
|
|
9
|
-
if ENV["KEEP_RUNNING"]
|
|
10
|
-
puts "Vagrant vm will be left up because KEEP_RUNNING is set."
|
|
11
|
-
puts "Rerun without KEEP_RUNNING set to cleanup the vm."
|
|
12
|
-
else
|
|
13
|
-
vagrant_cli_command("destroy -f")
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def vagrant_cli_command(command)
|
|
18
|
-
puts "[vagrant] #{command}"
|
|
19
|
-
stdout, stderr, status = Dir.chdir(VAGRANT_ROOT) do
|
|
20
|
-
Open3.capture3("#{VAGRANT_BIN} #{command}")
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
(stdout + stderr).each_line { |line| puts "[vagrant] #{line}" }
|
|
24
|
-
|
|
25
|
-
[stdout, stderr, status]
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def run_vagrant_command(command)
|
|
29
|
-
stdout, stderr, status = vagrant_cli_command("ssh -c #{command.inspect}")
|
|
30
|
-
return [stdout, stderr] if status.success?
|
|
31
|
-
raise VagrantSSHCommandError, status
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def puts(message)
|
|
35
|
-
# Attach log messages to the current cucumber feature (`log`),
|
|
36
|
-
# or simply puts to the console (`super`) if we are outside of cucumber.
|
|
37
|
-
respond_to?(:log) ? log(message) : super(message)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
World(VagrantHelpers)
|
data/spec/support/.gitignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.vagrant
|
data/spec/support/Vagrantfile
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
require "open-uri"
|
|
2
|
-
|
|
3
|
-
Vagrant.configure("2") do |config|
|
|
4
|
-
config.ssh.insert_key = false
|
|
5
|
-
|
|
6
|
-
[:app].each_with_index do |role, i|
|
|
7
|
-
config.vm.define(role, primary: true) do |primary|
|
|
8
|
-
primary.vm.define role
|
|
9
|
-
primary.vm.box = "hashicorp/bionic64"
|
|
10
|
-
primary.vm.network "forwarded_port", guest: 22, host: "222#{i}".to_i
|
|
11
|
-
primary.vm.provision :shell, inline: "sudo apt-get -y install git-core"
|
|
12
|
-
|
|
13
|
-
vagrantkey = open("https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub", "r", &:read)
|
|
14
|
-
|
|
15
|
-
primary.vm.provision :shell,
|
|
16
|
-
inline: <<-INLINE
|
|
17
|
-
install -d -m 700 /root/.ssh
|
|
18
|
-
echo -e "#{vagrantkey}" > /root/.ssh/authorized_keys
|
|
19
|
-
chmod 0600 /root/.ssh/authorized_keys
|
|
20
|
-
INLINE
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|