Run boot and console on relevant versions

Instead of just defaulting to local hash version
This commit is contained in:
David Heinemeier Hansson
2023-02-02 18:05:03 +01:00
parent c8f673ef7c
commit 6d80005f5d
4 changed files with 76 additions and 18 deletions

View File

@@ -1,6 +1,9 @@
require "mrsk/commands/base"
require "mrsk/commands/concerns/repository"
class Mrsk::Commands::App < Mrsk::Commands::Base
include Mrsk::Commands::Concerns::Repository
def run(role: :web)
role = config.role(role)

View File

@@ -0,0 +1,17 @@
module Mrsk::Commands::Concerns
module Repository
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=hey", "--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
end