Sha256: bed51c28ac338f8a103ff7856e5a375218b79441c8bd1db5692216abe851f2b9

Contents?: true

Size: 1.5 KB

Versions: 7

Compression:

Stored size: 1.5 KB

Contents

# frozen_string_literal: true

module Floe
  class Workflow
    class Runner
      include Logging

      TYPES         = %w[docker podman kubernetes].freeze
      OUTPUT_MARKER = "__FLOE_OUTPUT__\n"

      def initialize(_options = {})
      end

      class << self
        attr_writer :docker_runner

        def docker_runner
          @docker_runner ||= Floe::Workflow::Runner::Docker.new
        end

        def for_resource(resource)
          raise ArgumentError, "resource cannot be nil" if resource.nil?

          scheme = resource.split("://").first
          case scheme
          when "docker"
            docker_runner
          else
            raise "Invalid resource scheme [#{scheme}]"
          end
        end
      end

      def run!(resource, env = {}, secrets = {})
        raise NotImplementedError, "Must be implemented in a subclass"
      end

      # @return [Hash] runner_context
      def run_async!(_image, _env = {}, _secrets = {})
        raise NotImplementedError, "Must be implemented in a subclass"
      end

      def running?(_runner_context)
        raise NotImplementedError, "Must be implemented in a subclass"
      end

      def success?(_runner_context)
        raise NotImplementedError, "Must be implemented in a subclass"
      end

      def output(_runner_context)
        raise NotImplementedError, "Must be implemented in a subclass"
      end

      def cleanup(_runner_context)
        raise NotImplementedError, "Must be implemented in a subclass"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
floe-0.7.1 lib/floe/workflow/runner.rb
floe-0.8.0 lib/floe/workflow/runner.rb
floe-0.7.0 lib/floe/workflow/runner.rb
floe-0.6.1 lib/floe/workflow/runner.rb
floe-0.6.0 lib/floe/workflow/runner.rb
floe-0.5.0 lib/floe/workflow/runner.rb
floe-0.4.1 lib/floe/workflow/runner.rb