capistrano_deploy_lock 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +2 -3
- data/lib/capistrano/deploy_lock.rb +0 -2
- data/lib/capistrano/recipes/deploy_lock.rb +21 -13
- data/lib/capistrano_deploy_lock/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OGE3YzQ2MDUxYTBhZGEzYzY3ZDA3OTJiOWQ0NGQ2MTc0ODk2ODBjZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjhhNzFmMTFkY2E4YjU2YWE3NmEwZTIzNDlmMjc3OWYzMTYxYjFlYw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDk4ZDYzMmQxYzAzNWM5MGJmOWJkMjJhNWI0NGJhZjA2OWIzMzY1MjM4MTRk
|
10
|
+
ZjQ1ODUyOTJmM2ZkZWYwYjVlMGNjMTRjYTYwYzRlNDhhNjc1NGYxMGI3NThh
|
11
|
+
NTU4YWVlYTA0YTk1M2NkMzFjYWNlMzdjNjUyYjJlYmY0ZjViMDI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGEwZWYwYTNhZmMzNmM1YjVhMGFjN2VlMDY1YTU5NjkwMDlhMjg2Y2UxMTUx
|
14
|
+
Y2JlZDBjNDRmOTkwMDNjYmY4MWE1OWMzYTdhOTNiZDBhMDgzNjIxNGZlZTZm
|
15
|
+
OGFmNTk4ZTFiYzgxYjJiMmE3NGNlZjA2ZTE3ZTQ5ZGYzNTRlZTI=
|
data/README.md
CHANGED
@@ -21,14 +21,13 @@ Add this line to your `config/deploy.rb`:
|
|
21
21
|
## Usage
|
22
22
|
|
23
23
|
Your deploys will now be protected by a lock. Simply run `cap deploy` as usual.
|
24
|
-
However, if someone else tries to deploy at the same time, their deploy will
|
25
|
-
|
24
|
+
However, if someone else tries to deploy at the same time, their deploy will show
|
25
|
+
a message like this, and exit:
|
26
26
|
|
27
27
|
```
|
28
28
|
*** Deploy locked 3 minutes ago by 'ndbroadbent'
|
29
29
|
*** Message: Deploying master branch
|
30
30
|
*** Expires in 12 minutes
|
31
|
-
.../capistrano/deploy_lock.rb:132:in `block (3 levels) in <top (required)>': Capistrano::DeployLockedError (Capistrano::DeployLockedError)
|
32
31
|
```
|
33
32
|
|
34
33
|
The default deploy lock will expire after 15 minutes. This is so that crashed or interrupted deploys don't leave a stale lock behind.
|
@@ -19,12 +19,20 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
19
19
|
return if self[:deploy_lock_removed]
|
20
20
|
|
21
21
|
if self[:deploy_lock].nil?
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
# Check all matching servers for a deploy lock.
|
23
|
+
parallel do |session|
|
24
|
+
find_servers_for_task(current_task).each do |current_server|
|
25
|
+
session.else "[ -e #{deploy_lockfile} ] && cat #{deploy_lockfile} || true" do |ch, stream, output|
|
26
|
+
if output && output != ""
|
27
|
+
logger.info "Deploy lock found on: #{current_server.host}"
|
28
|
+
set :deploy_lock, YAML.load(output)
|
29
|
+
return
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
27
33
|
end
|
34
|
+
|
35
|
+
set :deploy_lock, false
|
28
36
|
end
|
29
37
|
end
|
30
38
|
|
@@ -39,13 +47,13 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
39
47
|
end
|
40
48
|
|
41
49
|
desc "Deploy with a custom deploy lock"
|
42
|
-
task :with_lock,
|
50
|
+
task :with_lock, :except => { :no_release => true } do
|
43
51
|
lock
|
44
52
|
deploy.default
|
45
53
|
end
|
46
54
|
|
47
55
|
desc "Set deploy lock with a custom lock message and expiry time"
|
48
|
-
task :lock,
|
56
|
+
task :lock, :except => { :no_release => true } do
|
49
57
|
set :lock_message, Capistrano::CLI.ui.ask("Lock Message: ")
|
50
58
|
set :custom_deploy_lock, true
|
51
59
|
|
@@ -74,7 +82,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
74
82
|
end
|
75
83
|
|
76
84
|
desc "Creates a lock file, so that futher deploys will be prevented"
|
77
|
-
task :create_lock,
|
85
|
+
task :create_lock, :except => { :no_release => true } do
|
78
86
|
if self[:deploy_lock]
|
79
87
|
logger.info 'Deploy lock already created.'
|
80
88
|
next
|
@@ -101,7 +109,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
101
109
|
|
102
110
|
namespace :unlock do
|
103
111
|
desc "Unlocks the server for deployment"
|
104
|
-
task :default,
|
112
|
+
task :default, :except => { :no_release => true } do
|
105
113
|
# Don't automatically remove custom deploy locks created by deploy:lock task
|
106
114
|
if self[:custom_deploy_lock]
|
107
115
|
logger.info 'Not removing custom deploy lock.'
|
@@ -110,13 +118,13 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
110
118
|
end
|
111
119
|
end
|
112
120
|
|
113
|
-
task :force,
|
121
|
+
task :force, :except => { :no_release => true } do
|
114
122
|
remove_deploy_lock
|
115
123
|
end
|
116
124
|
end
|
117
125
|
|
118
126
|
desc "Checks for a deploy lock. If present, deploy is aborted and message is displayed. Any expired locks are deleted."
|
119
|
-
task :check_lock,
|
127
|
+
task :check_lock, :except => { :no_release => true } do
|
120
128
|
# Don't check the lock if we just created it
|
121
129
|
next if self[:deploy_lock]
|
122
130
|
|
@@ -145,12 +153,12 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
145
153
|
end
|
146
154
|
puts
|
147
155
|
else
|
148
|
-
|
156
|
+
exit 1
|
149
157
|
end
|
150
158
|
end
|
151
159
|
|
152
160
|
desc "Refreshes an existing deploy lock's expiry time, if it is less than the default time"
|
153
|
-
task :refresh_lock,
|
161
|
+
task :refresh_lock, :except => { :no_release => true } do
|
154
162
|
fetch_deploy_lock
|
155
163
|
next unless self[:deploy_lock]
|
156
164
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano_deploy_lock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Broadbent
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Lock a server during deploy, to prevent people from deploying at the
|
14
14
|
same time.
|