Sha256: 492e0d6b32086f729559cc062df267bfe8137931e04af5bb95a96eb97727db83

Contents?: true

Size: 1.43 KB

Versions: 5

Compression:

Stored size: 1.43 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
exit workflow.status == "success" ? 0 : 1

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
floe-0.7.1 exe/floe
floe-0.7.0 exe/floe
floe-0.6.1 exe/floe
floe-0.6.0 exe/floe
floe-0.5.0 exe/floe