lib/floe/container_runner/podman.rb in floe-0.13.1 vs lib/floe/container_runner/podman.rb in floe-0.14.0

- old
+ new

@@ -28,17 +28,18 @@ @volumepath = options["volumepath"] end private - def run_container_params(image, env, secret) + def run_container_params(image, env, execution_id, secret) params = ["run"] params << :detach params += env.map { |k, v| [:e, "#{k}=#{v}"] } params << [:e, "_CREDENTIALS=/run/secrets/#{secret}"] if secret params << [:pull, @pull_policy] if @pull_policy params << [:net, "host"] if @network == "host" + params << [:label, "execution_id=#{execution_id}"] params << [:secret, secret] if secret params << [:name, container_name(image)] params << image end @@ -53,17 +54,19 @@ rescue nil end def parse_notice(notice) - id, status, exit_code = JSON.parse(notice).values_at("ID", "Status", "ContainerExitCode") + notice = JSON.parse(notice) + id, status, exit_code, attributes = notice.values_at("ID", "Status", "ContainerExitCode", "Attributes") - event = podman_event_status_to_event(status) - running = event != :delete + execution_id = attributes&.dig("execution_id") + event = podman_event_status_to_event(status) + running = event != :delete runner_context = {"container_ref" => id, "container_state" => {"Running" => running, "ExitCode" => exit_code.to_i}} - [event, runner_context] + [event, {"execution_id" => execution_id, "runner_context" => runner_context}] rescue JSON::ParserError [] end def podman_event_status_to_event(status)