mrsk 0.13.0 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mrsk/commands/app.rb +12 -8
- data/lib/mrsk/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f798abc56a655b00c23b0967edc93b3c420b71b50c92e28b986b35c6934ad91
|
4
|
+
data.tar.gz: b0606bf3e0874b765fbe6c5b17d941b326fc2da802a5fdf04f456547a2542fc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8528839c8f62dbfb766c670d30915f7ea8680a8f4c4b4bfc7bfffb3227a017c856b3dfbfb4df6fe6ab2c78371cd73e6d53f51ba01cdf998aeacbbf64cca73fdc
|
7
|
+
data.tar.gz: 47fd8f783ad74b2c4c518854f91a9b3ffb8db9d3f7fb929ee05e4e79f8995f3c831077dcbda116ea179201cbf8e8180af3b5cab8c5970acc9a4e81c31b188baa
|
data/lib/mrsk/commands/app.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
class Mrsk::Commands::App < Mrsk::Commands::Base
|
2
|
+
ACTIVE_DOCKER_STATUSES = [ :running, :restarting ]
|
3
|
+
|
2
4
|
attr_reader :role
|
3
5
|
|
4
6
|
def initialize(config, role: nil)
|
@@ -92,7 +94,7 @@ class Mrsk::Commands::App < Mrsk::Commands::Base
|
|
92
94
|
|
93
95
|
|
94
96
|
def current_running_container_id
|
95
|
-
docker :ps, "--quiet", *filter_args(
|
97
|
+
docker :ps, "--quiet", *filter_args(statuses: ACTIVE_DOCKER_STATUSES), "--latest"
|
96
98
|
end
|
97
99
|
|
98
100
|
def container_id_for_version(version, only_running: false)
|
@@ -100,12 +102,12 @@ class Mrsk::Commands::App < Mrsk::Commands::Base
|
|
100
102
|
end
|
101
103
|
|
102
104
|
def current_running_version
|
103
|
-
list_versions("--latest",
|
105
|
+
list_versions("--latest", statuses: ACTIVE_DOCKER_STATUSES)
|
104
106
|
end
|
105
107
|
|
106
|
-
def list_versions(*docker_args,
|
108
|
+
def list_versions(*docker_args, statuses: nil)
|
107
109
|
pipe \
|
108
|
-
docker(:ps, *filter_args(
|
110
|
+
docker(:ps, *filter_args(statuses: statuses), *docker_args, "--format", '"{{.Names}}"'),
|
109
111
|
%(grep -oE "\\-[^-]+$"), # Extract SHA from "service-role-dest-SHA"
|
110
112
|
%(cut -c 2-)
|
111
113
|
end
|
@@ -150,15 +152,17 @@ class Mrsk::Commands::App < Mrsk::Commands::Base
|
|
150
152
|
[ config.service, role, config.destination, version || config.version ].compact.join("-")
|
151
153
|
end
|
152
154
|
|
153
|
-
def filter_args(
|
154
|
-
argumentize "--filter", filters(
|
155
|
+
def filter_args(statuses: nil)
|
156
|
+
argumentize "--filter", filters(statuses: statuses)
|
155
157
|
end
|
156
158
|
|
157
|
-
def filters(
|
159
|
+
def filters(statuses: nil)
|
158
160
|
[ "label=service=#{config.service}" ].tap do |filters|
|
159
161
|
filters << "label=destination=#{config.destination}" if config.destination
|
160
162
|
filters << "label=role=#{role}" if role
|
161
|
-
|
163
|
+
statuses&.each do |status|
|
164
|
+
filters << "status=#{status}"
|
165
|
+
end
|
162
166
|
end
|
163
167
|
end
|
164
168
|
end
|
data/lib/mrsk/version.rb
CHANGED