Run
The run key defines the commands a task executes. It can be a single command or a multi-line script.
tasks:
- key: greet
run: echo hello
- key: build
run: |
echo building
make build
How your script runs
RWX runs your script with a couple of safety defaults. They're worth knowing about because they change what happens when a command fails.
A failing command stops the task
If any command exits with an error, the script stops right there and the task fails. Commands after the failing one don't run.
tasks:
- key: example
run: |
echo before
false # this fails…
echo after # …so this never runs, and the task fails
This surfaces failures instead of letting a broken step slip by. (If you've used shell scripts before, this is set -e, also called errexit.)
If a particular command is allowed to fail, you can add || true so its result is ignored:
run: rm cache.txt || true # don't fail the task if the file isn't there
A failing step in a pipeline fails the task
When you connect commands with |, the task fails if any command in the chain fails. For example, generate-report | tee report.txt fails if generate-report fails, even though tee succeeds. This behavior (known as pipefail) applies when your image includes Bash, which most do.
The shell RWX uses
The shell is chosen automatically based on your base image:
- If the image includes Bash (most do, like
ubuntu:24.04), scripts run with/bin/bash -l -e -o pipefail. - Otherwise (like
alpine), scripts run with/bin/sh -l -e. This behaves the same, except it doesn't have the pipeline behavior described above.
Either way it runs as a login shell (the -l), so your PATH and other profile settings are loaded the way you'd expect in a normal terminal.
For complex logic, consider committing a script to your repository and running
it (for example run: ./script/build). It's easier to test locally and keeps
your logic independent of these defaults.