Run Jobs With Mounted Volumes
Trigger scripts that need mounted directories, datasets, model files, or output paths by running them through a customer-owned TrigRun executor.
Use this pattern when a job needs filesystem access: host directories, NFS mounts, EFS volumes, model artifacts, backup folders, or generated output paths.
TrigRun does not mount volumes into TrigRun-managed infrastructure. Instead, TrigRun triggers a workspace executor that runs in your infrastructure, and that executor runs the command in an environment where the volumes are already mounted.
How it works
Use callback or poll mode for long-running work. TrigRun parks the execution while your executor works, then records the result when the executor calls back or when polling reports completion.
Example: Docker executor with host volumes
Run a TrigRun executor in your infrastructure and mount the directories your jobs need.
In this setup:
| Path inside executor | Purpose |
|---|---|
/opt/jobs | Versioned job scripts, mounted read-only |
/mnt/input | Input data, mounted read-only |
/mnt/output | Output directory for generated files |
The command TrigRun sends should reference the container paths, not the host paths.
Step 1: Store executor auth in TrigRun
Use a shared secret for the executor connection. HMAC auth is recommended for production executor dispatch.
If the script itself needs secrets, store those separately:
Step 2: Register the executor connection
EXECUTOR_ID is the id returned by trigrun executors create.
Step 3: Create a job that uses the mounted paths
This job runs inside the executor, where /mnt/input and /mnt/output are mounted.
For a one-off run, create and trigger the job immediately:
For an existing job, trigger it with:
Step 4: Inspect the execution
The execution record shows the executor connection, remote run id, stdout, stderr, exit code, timing, and final status. Keep large artifacts in your mounted output directory or object storage, and return a small structured reference in stdout or output.
Dynamic per-run mounts
If each run needs a different volume, keep that decision inside your executor gateway. The safer pattern is:
- TrigRun sends a constrained command or job name.
- Your executor maps that command to an approved volume definition.
- Your executor starts the real container, VM task, or Kubernetes job with those mounts.
- The executor returns the normalized result to TrigRun.
Avoid accepting arbitrary host paths, raw Docker flags, or Kubernetes volume specs from the TrigRun job payload. Treat mount selection as infrastructure policy owned by your executor.
For example, your executor can map a job name to a known container profile:
TrigRun should trigger daily-report; the executor should decide which image, mounts, and runtime options are allowed.
Kubernetes variant
In Kubernetes, run the executor as a service and mount a PersistentVolumeClaim into the executor pod, or have the executor create per-run Jobs with approved volume templates.
Safety checklist
- Mount input directories read-only whenever possible.
- Use a dedicated output directory for generated files.
- Use
bearerorhmacauth for the executor connection. - Do not send
secret://env vars to unauthenticated executors. - Keep
ALLOWED_COMMAND_PREFIXESnarrow. - Do not allow user-supplied host paths or container runtime flags.
- Prefer
callbackorpollmode for jobs that can run longer than a normal HTTP request. - Return small logs and artifact references to TrigRun instead of large files.