Task Definition YAML
YAML-based task configuration has been deprecated - the new script-based task deployment configuration is a lot simpler and easier to use. See the Node.js docs for help on getting started.
All tasks on Airplane are described by a YAML file called airplane.yml. This file includes how the task should be built, parameters for users to enter, environment variables to set at runtime, and more.
See Example below for a full task definition.

Field Reference

Basic Fields

1
name: Hello World
2
slug: hello_world
3
description: Greets you by name!
Copied!
    name: user-facing name for the task. This can be changed.
    slug: a unique identifier that ties this definition file to a task in Airplane. This cannot be changed (a different slug will end up creating a new task). See Slugs for more details.
    description: optional description for the task. Markdown is supported.

Slugs

Slugs are used across a few places in Airplane and serve as human-friendly identifiers. Tasks have slugs, as do parameters.
Slugs must:
    Be less than 50 characters long
    Use only lowercase letters, numbers, and underscores
    Start with a lowercase letter

Builder

1
node:
2
entrypoint: main.js
Copied!
Specify a builder using one of the accepted builders (node, python, go, deno, or dockerfile) and associated builder-specific configuration.

Builder-Specific Fields

For details on each builder, see the relevant builder doc:

Parameters

1
parameters:
2
- name: Name
3
slug: name
4
type: string
Copied!
    parameters: a list of parameters. Each parameter is a user-facing field to input data into the task. Parameters are referenced when creating the arguments to the task.
Each parameter supports the following fields:
    name: user-facing name for the parameter. This can be "User Email" rather than "user_email" - this appears in the web UI.
    slug: unique identifier for the parameter. This is the identifier you'll use to interpolate parameters into arguments, pass them when calling from the CLI, etc. See Slugs for details on restrictions.
    type: the type of the parameter. See below for valid types.
    default: optional, default value for the parameter. The allowed values for default depends on type.
    desc: optional, description of the parameter. This appears under the parameter as help text in the UI.
    constraints: optional, constraints configured on the parameter. See below for details.
    component: optional, renders a different interface for users. See below for details.

Type

The following types are supported:
    boolean: a true or false value.
    date: a date without a specific time (e.g. 2020-04-28). Date values must be strings that match yyyy-mm-dd.
    datetime: a date with a specific time, to the second (e.g. 2020-04-28 14:28:02). Datetime values must be strings that match RFC 3339 format yyyy-mm-ddThh:mm:ssZ, e.g. 2016-01-02T15:04:05Z.
    float: a number value, including whole numbers and decimals.
    integer: a whole number value.
    string: a normal string.
    upload: a user-uploaded file. Uploads in the UI allow users to select and upload files and provide them to tasks. Uploads currently have limited support outside the web UI.

Constraints

The following parameter constraint fields are supported:
1
parameters:
2
- name: Example
3
slug: name
4
type: string
5
constraints:
6
optional: true
7
regex: "^.*@airplane\.devquot;
Copied!
    optional: optional boolean for whether the parameter is required. By default, parameters are required.
    regex: optional regular expression string to validate string parameters. Regex constraints are expected to match the full input, so a ^ and $ must be included.

Component

The following components are supported–type must be string:
1
type: string
2
component: textarea
Copied!
1
type: string
2
component: editor-sql
Copied!

Arguments

Arguments are how Airplane translates parameters and anything hard-coded into a command to invoke the task:
1
arguments: ["--name", "{{name}}", "--email", "{{email}}"]
Copied!
1
arguments: ["{{JSON}}"]
Copied!
Arguments are list of strings passed to your task–these are equivalent to the arguments you might specify on the command line. For example, the Node builder results in the equivalent of:
1
node path/to/entrypoint.js [arguments...]
Copied!
Arguments can be just normal strings, but parameters can be interpolated in using Handlebars. For the most part, you don't need to know Handlebars but just need to know to use {{slug}} to interpolate the parameter of the given slug.
In addition, Airplane offers a special {{JSON}} interpolation that will interpolate all parameters as a single, combined JSON dictionary. For example, with parameters of name: string, age: integer, and is_suspended: boolean the resulting argument passed to your script will be the string:
1
'{"name": "some_name", "age": 45, "is_suspended": true}'
Copied!
For new tasks where you can control the argument interface, we recommend you use {{JSON}} to simplify argument passing and deserialize the JSON in your task:
main.js
1
const main = ({name, age, is_suspended}) => {
2
// Do stuff with name, age, is_suspended
3
}
4
5
main(JSON.parse(process.argv[2]));
Copied!

Env

The env section allows you to configure environment variables that are set when the task is executed. Environment variables can be hardcoded strings or reference config vars that you've set.
The env section should be a map of the environment variable name to a map with a single field:
    value: set this to use a hard-coded string value
    config: set this to to use a Config Var by name
1
env:
2
# Use a hardcoded string:
3
MY_ENV_VALUE_A:
4
value: "foo"
5
6
# Reference a config var:
7
MY_CONFIG_VALUE:
8
config: ops/db_url:prod
Copied!

Timeout

The timeout of the task can be configured in seconds:
1
timeout: 2400
Copied!
By default, tasks have a timeout set to 3600 (1 hour).

Root Config

By default, airplane uses the directory of the task definition as the root. The root is where airplane will build the task, and it is where files like package.json (Node) or requirements.txt (Python) are expected to live.
1
root: ../../
Copied!
You can set root to change it to e.g. a parent directory. The value of root is interpreted as a path relative to the directory containing the task definition.

ResourceLimits

For tasks that require more (or less) CPU / memory, you can specify how much CPU and/or memory to allocate.
1
resourceLimits:
2
cpu: 1000m
3
memory: 2Gi
Copied!
This feature is experimental and is subject to change. Airplane may cap excessively high CPU or memory limits.
CPU and memory are specified using Kubernetes resource unit syntax:
    cpu: defaults to 1000m. 1000m is 1000 millicpus or 1 CPU core, 2000m is 2 CPU cores, etc.
    memory: defaults to 2Gi. 2Gi is 2 Gibibytes, 500Mi is 500 Mebibytes. Power of 10 units are also supported: 2G is 2 Gigabytes, 500M is 500 Megabytes.

Example

Below is an example YAML definition showing the possible configuration:
1
name: Hello World
2
slug: hello_world
3
description: Greets you by name!
4
5
node:
6
entrypoint: main.js
7
language: javascript
8
nodeVersion: "15"
9
10
arguments: ["{{JSON}}"]
11
parameters:
12
- name: Name
13
slug: name
14
type: string
15
default: World
16
- name: Email
17
slug: email
18
type: string
19
constraints:
20
optional: true
21
regex: "^.*@airplane\.devquot;
22
23
env:
24
NODE_ENV: production
25
DATABASE_URL:
26
config: db_url
27
28
timeout: 120
29
root: ../../
30
resourceLimits:
31
cpu: 500m
32
memory: 200M
Copied!
Last modified 9d ago