Script
The Script adapter copies script source to the runner, executes it, and captures outputs from files written by the script.
Capabilities
Section titled “Capabilities”Required runner capabilities:
| Capability | Why it is required |
|---|---|
Exec | Runs scripts on the runner. |
FileCopy | Copies embedded scripts, source files, with-files, and output files. |
Sources
Section titled “Sources”Supported source modes:
| Source mode | Supported | Behavior |
|---|---|---|
embedded | Yes | Written to script.sh, copied to the runner, then executed. |
files | Yes | Each mapped file is copied to the runner and executed sequentially. |
path | No | Intentionally not supported for scripts. Use files for executable scripts and with for supporting files. |
Example:
components: setup: type: script runner: local source: embedded: | echo "token=abc" >> "$ORCH_OUTPUT_ENV"For source.files, map runner-side script names to local files:
source: files: 01-setup.sh: ./scripts/setup.sh 02-check.sh: ./scripts/check.shScripts from source.files are executed sequentially after copy.
Config
Section titled “Config”| Field | Type | Default | Description |
|---|---|---|---|
shell | list of strings | ["sh"] | Shell command prefix used to run each script. |
Example:
config: shell: ["bash"]The adapter runs each script as:
<shell...> ./<script>Hooks use a different default: ["sh", "-c"].
Environment
Section titled “Environment”Component env values are passed to the script. The adapter also sets:
| Variable | Description |
|---|---|
ORCH_OUTPUT_ENV | Relative path to the env-style output file. Defaults to .orch-outputs.env. |
ORCH_OUTPUT_JSON | Relative path to the JSON output file. Defaults to .orch-outputs.json. |
Outputs
Section titled “Outputs”Script outputs must be declared in the component’s outputs list unless they are reserved _meta outputs.
Environment file format:
echo "name=value" >> "$ORCH_OUTPUT_ENV"Multiple echo calls are supported. If the same key is written more than once, the last value wins.
JSON file format:
cat > "$ORCH_OUTPUT_JSON" <<'JSON'{ "url": "http://localhost:8080", "enabled": true, "port": 8080}JSONJSON outputs must be scalar values: string, number, boolean, or null.
Example declaration:
outputs: - name: token sensitive: true - name: urlSensitive outputs are available during the same orch up, but are not persisted in state.
Apply Behavior
Section titled “Apply Behavior”Apply does the following:
- Creates the component workdir on the runner.
- Copies script source to the runner.
- Copies
withfiles to the runner workdir. - Clears previous
.orch-outputs.envand.orch-outputs.json. - Executes scripts sequentially.
- Copies output files back to Orch and parses outputs.
- Stores script list, shell, and workdir in component state.
Destroy Behavior
Section titled “Destroy Behavior”Script components do not have adapter-specific destroy behavior. Use pre_destroy and post_destroy lifecycle hooks for teardown commands.