Extract versions that contains dashes
The version extraction assumed that the version is everything after the last `-` in the container name. This doesn't work if you deploy a non-MRSK generated version that contains a `-`. To fix we'll generate the non version prefix and strip it off. In some places for this to work we need to make sure to pass the role through. Fixes: https://github.com/mrsked/mrsk/issues/402
This commit is contained in:
@@ -112,8 +112,7 @@ class Mrsk::Commands::App < Mrsk::Commands::Base
|
||||
def list_versions(*docker_args, statuses: nil)
|
||||
pipe \
|
||||
docker(:ps, *filter_args(statuses: statuses), *docker_args, "--format", '"{{.Names}}"'),
|
||||
%(grep -oE "\\-[^-]+$"), # Extract SHA from "service-role-dest-SHA"
|
||||
%(cut -c 2-)
|
||||
%(while read line; do echo ${line##{service_role_dest}-}; done) # Extract SHA from "service-role-dest-SHA"
|
||||
end
|
||||
|
||||
def list_containers
|
||||
@@ -160,6 +159,10 @@ class Mrsk::Commands::App < Mrsk::Commands::Base
|
||||
argumentize "--filter", filters(statuses: statuses)
|
||||
end
|
||||
|
||||
def service_role_dest
|
||||
[config.service, role, config.destination].compact.join("-")
|
||||
end
|
||||
|
||||
def filters(statuses: nil)
|
||||
[ "label=service=#{config.service}" ].tap do |filters|
|
||||
filters << "label=destination=#{config.destination}" if config.destination
|
||||
|
||||
Reference in New Issue
Block a user