Do the same with co
Do everything from the screen with co commands, and what to do when a command is refused
Everything you did on screen in the previous pages can also be done with co commands. The result is the same, so a pipeline created with a command can be edited on screen and the other way round. Use these commands when you hand pipeline work to an AI agent, too.
New to co? Install it and log in with the quick start. Each command is described in Pipeline commands, and every option is in co <command> --help.
Prepare to deploy
Services and environments can be created with co. A connection installs an Agent in your cluster, so register it on screen under Deploy, then Connections.
co service create api --name "API" --type kubernetes -p CORE # what to deploy
co env create prod --tier prod --type prod -p CORE # where to deploy
co service spec get api -p CORE > api.yml # get the service settings as a file
co service spec set api -f api.yml -p CORE --base <updated_at> # upload the edited settingsThe detailed settings of a service or an environment are the same YAML the spec editor on screen saves. See Services and environments.
Create a pipeline
Pick the screen's starting point with --start. The server writes the YAML for that starting point and co saves it as a new pipeline.
co pipeline create --start build-deploy --repo web --service web --env prod --name web-release -p CORE--start | Starting point on screen | Also pass |
|---|---|---|
build | Build only | --repo |
deploy | Deploy only | --service --env |
build-deploy | Build and deploy | --repo --service --env |
approve-deploy | Deploy after approval | --repo --service --env --approver |
If you leave a field out, nothing is saved: co names the place to fill in and exits with code 3. To look at the YAML before saving, add --print. It prints the YAML and saves nothing.
Edit as a file
Everything you did in the graph (adding jobs, job settings, approval jobs, triggers) lives in the YAML. Get the same YAML the YAML view shows, edit it and upload it again.
co pipeline view 42 # jobs, inputs, input sets, triggers, recent runs, version
co pipeline view 42 --yaml > p.yml # get a fresh copy right before editing
co pipeline validate -f p.yml 42 # check without saving
co pipeline apply -f p.yml 42 --if-version 3 # save only if nobody changed it since version 3validate runs the same checks as saving. Each problem shows its line and YAML path (for example jobs.deploy.deployment), and problems exit with code 3. Lines starting with ! are warnings: the save goes through, but the setting does nothing, so take a look.
Triggers live under triggers: in the YAML, as push, change_request and schedule. The first time, it is easiest to create one trigger on screen, look at it with view --yaml and follow that shape.
Without --if-version, your save silently overwrites whatever someone else saved in between. The version is shown by co pipeline view; if it no longer matches, nothing is saved and co exits with code 4.
Input sets and runs
co pipeline input-set list 42
co pipeline input-set set 42 to-prod --input target=prod --input replicas=3 # values
co pipeline input-set set 42 prod-canary --set to-prod --set canary # layer
co pipeline input-set rm 42 prod-canary
co pipeline run 42 --set to-prod --input version=1.2.3input-set set and rm change only that one set. Two people editing different sets at the same time do not erase each other's work.
When you run, values stack in this order and later ones win: declared defaults, each --set in the order given, then each --input. If you pass an input name the pipeline does not declare, co stops before sending. This keeps a typo from quietly running with the default value.
co pipeline run prints the run number and status. If the server does not answer, co sends the same request once more, and the server returns the run the first request made, so nothing runs twice.
Approve
co run view 281 # see the job waiting for approval
co run approve 281 deploy-gate --comment "checked on stage"
co run reject 281 deploy-gate --comment "wrong version"The job name is the one in the YAML. If the job can't be decided (not an approval job, the run hasn't reached it, already decided, or you are not an approver), co tells you before sending. Approval is a person's decision; don't hand it to an AI agent.
Watch and re-run
co run view 281 # job status, failure cause, last few log lines
co run logs 281 --failed --tail 50 # last 50 lines of each failed step
co run rerun 281 --from-failed # re-run from the failure
co run rerun 281 # re-run from the start
co run cancel 281 # stop the run
co project onboarding matrix CORE # which service deploys to which environmentDelete
co pipeline delete 42Unfinished runs are cancelled first. Before deleting, co shows which runs will be cancelled and asks.
When a command is refused
co exits with a different code depending on why it failed. With --json, the error is printed as JSON on stderr too, and reason holds a machine-readable reason. The shape is in Automation and AI agents, under Exit codes and errors.
| Exit code and reason | What a person does | What an AI agent does |
|---|---|---|
| 3 YAML problem, missing field | Fix the line and path shown, then upload again | Fix the path in details and send again. If the same problem comes back twice, stop and report |
4 stale_version | Get a fresh copy and redo your change on it | Get a fresh copy, redo the change and retry once. If refused again, stop |
4 manual_run_recent, rerun_recent | The run you just started is going; check the run list | Don't send again. Find the run that just started and watch it |
4 already_decided | Someone decided first; look at the run | Don't count it as success. Read the decision and report it |
4 not_waiting | It isn't time to approve yet | Wait, then read the status again |
5 not_approver, self_approval | Ask an approver | Stop and hand it to a person. Never switch to another account |
| 6 not found | Check the key and the project | Read the list again |
| 7 server error, timeout | Try again a bit later | Retry reads. Retry a write only when retryable is true; otherwise check the result first |
When co refuses before sending (an undeclared input, a job that can't be decided and so on), the exit code is 1 and the message says what is wrong.
If co pipeline run ends with exit code 7, co has already sent it once more. Before running again, check the recent runs in co pipeline view <key> to see whether a run was created.