A tiny single-file Go client for HashiCorp Nomad: run one command as a short-lived batch job and get its exit code back locally.
It:
- Registers a short-lived batch job in Nomad to run one command
- Streams task output best-effort and returns the task exit code locally
- Supports pinning placement to a specific client by IP (useful for Windows)
- Supports passing environment variables to the task
- Supports bazz-like
-input,-output, and-working-directoryflags - Uploads declared input files before execution and downloads declared output files after a successful run
./nomm \
-address http://127.0.0.1:4646 \
-input ./src/a.txt -input ./src/b.txt \
-output ./out/result.txt \
-- \
sh -lc 'cat a.txt b.txt > ../out/result.txt'
Simple execution without uploaded inputs still works too:
./nomm \
-address http://127.0.0.1:4646 \
-datacenter dc1 \
-environment FOO=bar \
-environment BAZ=qux \
-- \
sh -lc 'echo hello'
Windows client example (`raw_exec` on a Windows Nomad client at a specific IP):
./nomm \
-address http://127.0.0.1:4646 \
-node-ip 192.168.3.168 \
-- \
cmd /c verYou can also set NOMAD_ADDR and NOMAD_TOKEN in the environment instead of passing -address / -token.
Nomad connection:
-address: Nomad address (defaulthttp://127.0.0.1:4646)-token: Nomad ACL token (optional)-namespace: Nomad namespace (optional)-region: Nomad region (optional)
TLS:
-tls-ca: CA cert to trust (optional)-tls-cert/-tls-key: mTLS client cert + key (optional; must be provided together)-tls-server-name: TLS SNI override (optional)-tls-insecure-skip-verify: skip TLS hostname/SAN verification (insecure)
Job shape:
-datacenter: datacenter (repeatable or comma-separated; defaults todc1)-driver:raw_exec(default) ordocker-docker-image: required when-driver=docker-environment: env varKEY=VALUE(repeatable)-input: input file path (repeatable or comma-separated)-output: expected output file path (repeatable or comma-separated)-working-directory: remote working directory relative to the uploaded input root-cpu: CPU MHz (default100)-memory: memory MB (default128)
Lifecycle:
-timeout: overall timeout for register → alloc completion (default30m)-keep-job: do not deregister job after completion-dry-run: print computed job info and exit without contacting Nomad
- The input/output path model mirrors
bazz: inputs are uploaded relative to their most common input directory, and outputs are written back relative to their most common output directory. - Declared
-outputpaths are resolved from the staged remote working directory, so-working-directory subdir -output result.txtlooks forsubdir/result.txtin the staged workspace and writes backresult.txtlocally. - The upload/download path is implemented for
raw_execand selects a platform-specific wrapper automatically from the target node's OS. - On Windows
raw_execnodes, the generated wrapper uses Windows PowerShell and .NET file APIs: PowerShell stages uploaded inputs by Base64-decoding directly to disk before invoking the requested command from the staged workspace. - On POSIX
raw_execnodes, the generated wrapper uses/bin/sh. AllocFSis used only for reading outputs and logs back from the allocation. The Nomad API exposed byAllocFSis read-only, so uploads cannot be performed through it.
