Corbie

Plugins

machines

A script uses this plugin to define a machine while its job runs.

  1. A script calls machines.define with a definition as YAML text.
  2. The job's process checks the definition as a submitted one is checked, and stores it, under the job's time and memory limits.
  3. The script returns the stored definition in its output.
  4. A later job's machine: is one expression that gives that output, and the controller starts the machine as a child run.

A script cannot start a machine.

  machines.define(yaml, { files })    returns the stored definition

Options:

  files   a map from the path of each script the definition names to its text

Errors:

  bad_input   the definition fails its check; the message lists every problem

The child run is allowed only what the job that starts it lists in allow:, whatever its definition allows. With no allow: there, it is allowed nothing.

Needs nothing: every job may define machines.

The first stage of this flow makes a flow, and the second runs it.

# plan.yaml

flow: plan
stages:
  make: { job: ./make.js }
  made: { job: { machine: "${stages.make.output.definition}", allow: [net:example.com] } }
output: ${stages.made.output}

// make.js

const text = "flow: made\nstages:\n  step: { job: ./step.js }\noutput: ${stages.step.output}\n"
return { definition: machines.define(text, { files: { "./step.js": "return 1" } }) }
corbie test plan.yaml  output: 1