Command line
forge is Forge's command line; the command line shows how to
install it and log in. This is the list forge prints when run without arguments. Run
forge COMMAND -h for a command's flags.
Usage: forge <command> [flags]
Commands:
run [flags] IMAGE [ARG...] start a run and follow its output (--detach to only start it)
run --template NAME [--param NAME=value...]
start a run from a template
run --local [FILE] run a run file (default .forge/run.yaml) with the local Docker
run --compose FILE --exit-from SERVICE
run a compose file with Docker in a VM of its own
templates [TEMPLATE] list the project's templates, or show one's parameters
flow check FILE check a flow file (stages of steps) without a server
flow run [-d] FILE start a flow run and follow its steps (also: flow show, flow cancel)
flow run --local FILE run a flow file's steps with the local Docker
logs [-f] [--service NAME] RUN
print a run's output, or its service's (-f: follow until it ends)
wait RUN wait until a run has finished; exits with its code
cancel RUN cancel a run
keep RUN / unkeep RUN keep an ended run's logs, artifacts and record from retention, or stop
debug [--keep 15m] [--always] RUN
re-run an ended run and open a shell in its container once its
process failed (or ended, with --always)
shell RUN open a shell in a run held for debugging
approve [-m TEXT] RUN approve a run that waits to deploy to an environment
reject [-m TEXT] RUN reject it
outputs [--json] RUN [NAME] print an ended run's outputs as NAME=value lines, or one's value
cache list [--key PREFIX] list the project's cache entries and what they take of its quota
cache delete ENTRY | --key PREFIX | --all
delete cache entries
environments [--project P] list the project's environments; show, add, set and delete NAME
show and change one and its protection rules
activity [-f] [--project P | --org ORG] [--kind KINDS]
print what happened in a project or organization (-f: follow)
insights [--project P | --org ORG] [--from DAY] [--to DAY]
print how runs did over days: reliability, speed, cost, right-sizing
plan [--org ORG] show the organization's plan, usage and anything unpaid
invoices [NUMBER] [--pdf FILE]
list invoices, show one, or save its PDF
classes list the runner classes and their rates
locations list the runners' locations and the regions
runner-groups [--org ORG | --project P]
list runner groups; runner-groups key GROUP NAME creates a join
key (--cloud-init: print user-data with it); runner-groups
autoscale GROUP --provider NAME | --off sets its autoscaling;
runner-groups machines GROUP lists its machines
machine-providers [--org ORG | --project P]
list machine providers; add NAME KIND, token NAME (the token is
read from stdin) and delete NAME change them
registries [--org ORG | --project P]
list image registries; add NAME HOST, login NAME pull|push
--username U (the password is read from stdin), test NAME and
delete NAME change them
tests split --total N --index I [--dirs] GLOB...
print this part's test files, split by earlier reports' times
(in a run, also as /forge/bin/forge)
hook send --event E --ref REF --sha SHA | hook post-receive
send a generic Git server's signed delivery to a linked
repository's webhook (FORGE_HOOK_URL, FORGE_HOOK_SECRET); in a
post-receive hook, one per pushed branch or tag
login keep a token for a server (read from stdin)
logout forget it
whoami print who the token belongs to
version print the version
Every command takes --server (or FORGE_SERVER; default: the one logged in to) and uses the
token in FORGE_TOKEN, else the one forge login kept. Run "forge <command> -h" for its flags.
Environment
| Variable | Meaning |
|---|---|
FORGE_SERVER |
The server, when not given with --server. Default: the one forge login kept. |
FORGE_TOKEN |
The token, instead of the one forge login kept. |
FORGE_PROJECT |
The project, for commands that take --project. |
Exit codes
Commands that follow a run (forge run, forge wait) exit with the run's own exit code, so
they fit in scripts. Besides those:
| Code | Meaning |
|---|---|
| 124 | The run timed out. |
| 130 | The run was cancelled. |
| 125 | Forge couldn't do it: wrong usage, an error from the API, or a lost run. |