Sha256: 9a6670cab6acb6182f5adcc391da0e7f5d217ae0d787ac9dd9b91d2c8dc23fca

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require "floe"
require "optimist"

opts = Optimist.options do
  version("v#{Floe::VERSION}\n")
  opt :workflow, "Path to your workflow json",                 :type => :string, :required => true
  opt :input, "JSON payload to input to the workflow",         :default => '{}'
  opt :credentials, "JSON payload with credentials",           :default => "{}"
  opt :docker_runner, "Type of runner for docker images",      :default => "docker"
  opt :docker_runner_options, "Options to pass to the runner", :type => :strings
end

Optimist.die(:docker_runner, "must be one of #{Floe::Workflow::Runner::TYPES.join(", ")}") unless Floe::Workflow::Runner::TYPES.include?(opts[:docker_runner])

require "logger"
Floe.logger = Logger.new($stdout)

runner_klass = case opts[:docker_runner]
               when "docker"
                 Floe::Workflow::Runner::Docker
               when "podman"
                 Floe::Workflow::Runner::Podman
               when "kubernetes"
                 Floe::Workflow::Runner::Kubernetes
               end

runner_options = opts[:docker_runner_options].to_h { |opt| opt.split("=", 2) }

Floe::Workflow::Runner.docker_runner = runner_klass.new(runner_options)

context = Floe::Workflow::Context.new(:input => opts[:input])
workflow = Floe::Workflow.load(opts[:workflow], context, opts[:credentials])

workflow.run!

puts workflow.output.inspect

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
floe-0.4.1 exe/floe
floe-0.4.0 exe/floe