shiplane_deployers_capistrano_docker 0.2.24 → 0.2.25
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a9594fa7bcaf039459fc10accab4f55abf669857fd735cd7ea1fdd35dcd8115a
|
|
4
|
+
data.tar.gz: e16d7407b7eb4857f0116e8e34cb3d1be0b380ffd936bdb8e33b03e37b2a1252
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bd52b61de9281bb8eaddef0b2ea321168361ca104e1ffb05b8e58cc2703b444b1c854e092a8b1fe626b283357728f43d7bfa70d2a17d5077817e0b1ff0098c73
|
|
7
|
+
data.tar.gz: 230a3613adb6cded45119c178f657b55d5147e6531ea1e20ec8577e38daae9dba2e2eb31e1e7d60fd24b92754505cf59947d135aa8daf8256b1df9df33d620e0
|
|
@@ -46,7 +46,7 @@ namespace :shiplane do
|
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
desc "Deploy the current branch to production via its docker container"
|
|
49
|
-
task deploy: [:instantiate_shiplane_environment, :create_networks, :download_container, :stop_old_containers, :remove_conflicting_containers] do
|
|
49
|
+
task deploy: [:instantiate_shiplane_environment, :create_networks, :download_container, :stop_old_containers, :remove_conflicting_containers, :cleanup_old_releases] do
|
|
50
50
|
fetch(:shiplane_container_configurations).each do |name, config|
|
|
51
51
|
roles = roles(config.fetch(:capistrano_role, :all)).map{|role| Shiplane::Host.new(role, env) }
|
|
52
52
|
roles.each do |role|
|
|
@@ -84,4 +84,30 @@ namespace :shiplane do
|
|
|
84
84
|
end
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
|
+
|
|
88
|
+
task :cleanup_old_releases do
|
|
89
|
+
all_roles = {}
|
|
90
|
+
|
|
91
|
+
fetch(:shiplane_container_configurations).each do |name, config|
|
|
92
|
+
roles = roles(config.fetch(:capistrano_role, :all)).map{|role| Shiplane::Host.new(role, env) }
|
|
93
|
+
|
|
94
|
+
roles.each do |role|
|
|
95
|
+
all_roles[role] = config.docker_command(role)
|
|
96
|
+
on role.capistrano_role do
|
|
97
|
+
container_ids_to_keep = capture("#{config.docker_command(role)} container ls -aq --filter name=#{config.container_name} -n #{config.env.fetch(:keep_releases, 5)}").split("\n")
|
|
98
|
+
all_container_ids = capture("#{config.docker_command(role)} container ls -aq --filter name=#{config.container_name}").split("\n")
|
|
99
|
+
|
|
100
|
+
(all_container_ids - container_ids_to_keep).each do |container_id|
|
|
101
|
+
execute "#{config.docker_command(role)} rm #{container_id}"
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
all_roles.keys.each do |role|
|
|
108
|
+
on role.capistrano_role do
|
|
109
|
+
execute "#{all_roles[role]} image prune -fa"
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
87
113
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shiplane_deployers_capistrano_docker
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.25
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- John Epperson
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-08-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: capistrano
|