diff --git a/lib/command/run.rb b/lib/command/run.rb index a90be654..8794b05c 100644 --- a/lib/command/run.rb +++ b/lib/command/run.rb @@ -84,9 +84,9 @@ class Run < Base # rubocop:disable Metrics/ClassLength EX attr_reader :interactive, :detached, :location, :original_workload, :runner_workload, - :container, :image_link, :job, :replica, :command + :container, :image_link, :image_changed, :job, :replica, :command - def call # rubocop:disable Metrics/MethodLength + def call # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity @interactive = config.options[:interactive] || interactive_command? @detached = config.options[:detached] @@ -113,6 +113,11 @@ def call # rubocop:disable Metrics/MethodLength update_runner_workload wait_for_runner_workload_update + # NOTE: need to wait some time before starting the job, + # otherwise the image may not be updated yet + # TODO: need to figure out if there's a better way to do this + sleep 1 if image_changed + start_job wait_for_replica_for_job @@ -181,6 +186,7 @@ def update_runner_workload # rubocop:disable Metrics/MethodLength else @image_link = original_container_spec["image"] end + @image_changed = container_spec["image"] != image_link container_spec["image"] = image_link # Container overrides