Repository really is app specific, since it relies on versions
This commit is contained in:
@@ -2,8 +2,7 @@ require "mrsk/commands/base"
|
||||
require "mrsk/commands/concerns"
|
||||
|
||||
class Mrsk::Commands::App < Mrsk::Commands::Base
|
||||
include Mrsk::Commands::Concerns::Executions,
|
||||
Mrsk::Commands::Concerns::Repository
|
||||
include Mrsk::Commands::Concerns::Executions
|
||||
|
||||
def run(role: :web)
|
||||
role = config.role(role)
|
||||
@@ -51,6 +50,24 @@ class Mrsk::Commands::App < Mrsk::Commands::Base
|
||||
).join(" "), host: host
|
||||
end
|
||||
|
||||
def container_id_for(container_name:)
|
||||
docker :container, :ls, "-a", "-f", "name=#{container_name}", "-q"
|
||||
end
|
||||
|
||||
def current_running_version
|
||||
# FIXME: Find more graceful way to extract the version from "app-version" than using sed and tail!
|
||||
pipe \
|
||||
docker(:ps, "--filter", "label=service=#{service_name}", "--format", '"{{.Names}}"'),
|
||||
%(sed 's/-/\\n/g'),
|
||||
"tail -n 1"
|
||||
end
|
||||
|
||||
def most_recent_version_from_available_images
|
||||
pipe \
|
||||
docker(:image, :ls, "--format", '"{{.Tag}}"', config.repository),
|
||||
"head -n 1"
|
||||
end
|
||||
|
||||
def list_containers
|
||||
docker :container, :ls, "-a", *service_filter
|
||||
end
|
||||
|
||||
@@ -2,4 +2,3 @@ module Mrsk::Commands::Concerns
|
||||
end
|
||||
|
||||
require "mrsk/commands/concerns/executions"
|
||||
require "mrsk/commands/concerns/repository"
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
module Mrsk::Commands::Concerns::Repository
|
||||
def container_id_for(container_name:)
|
||||
docker :container, :ls, "-a", "-f", "name=#{container_name}", "-q"
|
||||
end
|
||||
|
||||
def current_running_version
|
||||
# FIXME: Find more graceful way to extract the version from "app-version" than using sed and tail!
|
||||
pipe \
|
||||
docker(:ps, "--filter", "label=service=#{service_name}", "--format", '"{{.Names}}"'),
|
||||
%(sed 's/-/\\n/g'),
|
||||
"tail -n 1"
|
||||
end
|
||||
|
||||
def most_recent_version_from_available_images
|
||||
pipe \
|
||||
docker(:image, :ls, "--format", '"{{.Tag}}"', config.repository),
|
||||
"head -n 1"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user