Class: Highway::Runtime::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/highway/runtime/runner.rb

Overview

This class is responsible for evaluating invocation parameters, then validating and running step invocations.

Instance Method Summary collapse

Constructor Details

#initialize(manifest:, context:, interface:) ⇒ Runner

Initialize an instance.



30
31
32
33
34
# File 'lib/highway/runtime/runner.rb', line 30

def initialize(manifest:, context:, interface:)
  @manifest = manifest
  @context = context
  @interface = interface
end

Instance Method Details

#runObject

Run the build manifest.

The runner prevalidates the step invocations if they don’t contain any environments variables, then runs step invocations.

This method catches exceptions thrown inside steps in order to maintain control over the execution policy.



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/highway/runtime/runner.rb', line 43

def run()

  # Validate invocations before running them. At this point we're able
  # to evaluate non-environment variables, typecheck and validate the
  # parameters.

  prevalidate_invocations()

  # Prepare the artifacts directory. If it doesn't exist, it's created at
  # this point. If it exist, it's removed and re-created.

  prepare_artifacts_dir()

  # Run invocations one-by-one.

  run_invocations()

  # Print the metrics table containing the status of invocation, its step
  # name and a duration it took.

  report_metrics()

  # Now it's time to raise an error if any of the steps failed.

  if @context.reports_any_failed?
    @interface.fatal!(nil)
  end

end