Common Workflows
Multi-command playbooks for typical octo-cli usage scenarios. Each step has its own copyable code block — paste them one at a time. Full per-command documentation is in the Command Reference sidebar section.
Initial Setup
-
Configure endpoints:
octo-cli -c Config `-isu "https://localhost:5003/" `-asu "https://localhost:5001/" `-tid "meshtest" -
Login:
octo-cli -c LogIn -i -
Create tenant:
octo-cli -c Create -tid "myproject" -db "myproject_db" -
Grant yourself access to the new tenant:
octo-cli -c ProvisionCurrentUser -ttid "myproject" -
Switch to new tenant context:
octo-cli -c Config -tid "myproject" -isu "https://localhost:5003/"octo-cli -c LogIn -i -
Import construction kit:
octo-cli -c ImportCk -f "./my-model.yaml" -w
See Tenant Lifecycle for detailed guidance on creating, attaching, and restoring tenants.
Manage Contexts
Contexts work like kubectl contexts — each one bundles its own service URIs, tenant ID, and stored access/refresh token. Switching contexts is how you target different environments (dev / prod / customer-X) without reconfiguring everything. They live in ~/.octo-cli/contexts.json.
| Command | Description |
|---|---|
AddContext | Add or update a named context |
UseContext | Switch the active context |
ListContexts | List all contexts, or show details of one |
RemoveContext | Remove a context |
-
Add a new context (with all relevant service URIs):
octo-cli -c AddContext -n staging-1_meshtest `-isu https://connect.staging.octo-mesh.com/ `-asu https://assets.staging.octo-mesh.com/ `-bsu https://bots.staging.octo-mesh.com/ `-csu https://communication.staging.octo-mesh.com/ `-tid meshtestThe first context added is automatically activated. Subsequent
AddContextcalls update if the name already exists. See theAddContextreference page for the full list of service-URI flags. -
List contexts and inspect details:
Tabular list of all contexts — the active one is marked with
*:octo-cli -c ListContextsDetail view of a single context — shows all service URIs and auth status:
octo-cli -c ListContexts -n staging-1_meshtestJSON output for scripting (jq, ConvertFrom-Json, etc.):
octo-cli -c ListContexts -jThe
Authcolumn reports one of:no token (run LogIn),authenticated (expires <timestamp>[, refresh available]), orexpired (expires <timestamp>). Access and refresh tokens are never written to the output, only the expiry timestamp and ahasRefreshTokenflag (in JSON mode). -
Switch the active context — all subsequent commands target this context's tenant and services:
octo-cli -c UseContext -n staging-1_meshtest -
Remove a context when no longer needed (does not affect the remote service):
octo-cli -c RemoveContext -n old-contextIf the removed context was active, another context becomes active automatically (or none if it was the last).
Context selection is the prerequisite for LogInClientCredentials (see Non-Interactive Authentication below) — that command does not accept -tid; it reads the tenant from the active context.
Add Web Application Client
-
Create client:
octo-cli -c AddAuthorizationCodeClient `-id "my-webapp" `-n "My Web App" `-u "https://myapp.com/" `-ru "https://myapp.com/auth/callback" -
Add required scopes:
octo-cli -c AddScopeToClient -id "my-webapp" -n "assetSystemAPI.full_access"octo-cli -c AddScopeToClient -id "my-webapp" -n "identityAPI.full_access"
Set Up Group-Based Access
-
Create a group with roles:
octo-cli -c CreateGroup `-n "Operators" `-d "Operations team" `-rids "DashboardViewer,ReportingViewer" -
Add users to the group:
octo-cli -c AddUserToGroup -id "<group-rtid>" -uid "<user-id>" -
Optionally set up automatic assignment by email domain:
octo-cli -c CreateEmailDomainGroupRule `-edp "company.com" `-tgid "<group-rtid>" `-d "Auto-assign company employees"
Set Up Cross-Tenant Access
In the child tenant: add OctoTenant provider pointing to parent, then create user mappings.
-
Switch to the child tenant context:
octo-cli -c Config -tid "child-tenant" -isu "https://id.example.com/"octo-cli -c LogIn -i -
Add OctoTenant identity provider:
octo-cli -c AddOctoTenantIdentityProvider `-n "Parent Auth" `-ptid "octosystem" `-e true -
Create user mappings:
octo-cli -c CreateExternalTenantUserMapping `-stid "octosystem" `-suid "<user-id>" `-sun "alice" `-rids "Development,DashboardViewer"
See Cross-Tenant Authentication for details.
Non-Interactive Authentication
Set up client_credentials authentication for any unattended caller — a CI pipeline, a cron job, a systemd service, a container entrypoint, a remote-administration script, etc. Run the setup steps once from a workstation; the runtime steps execute on each invocation of the script or job.
One-time Setup (Workstation)
-
Authenticate as a user with permission to create clients in the target tenant:
octo-cli -c UseContext -n prodocto-cli -c LogIn -i -
Create a
client_credentialsclient in that tenant:octo-cli -c AddClientCredentialsClient `-id "my-script-client" `-n "Headless script client" `-s "<generated-secret>" -
Store the client ID + secret in a secrets manager — Azure DevOps variable group, GitHub Actions secret, Vault, AWS Secrets Manager, a private file readable only by the running user, etc.
On Each Script / Job Run
-
Pin the context so the tenant is correct:
octo-cli -c UseContext -n prod -
Export credentials from wherever they're stored:
$env:OCTO_CLI_CLIENT_ID = "<from secret store>"$env:OCTO_CLI_CLIENT_SECRET = "<from secret store>" -
Login — tokens auto-renew while the env vars remain in scope, so a long-running script does not need to call
LogInClientCredentialsagain between commands:octo-cli -c LogInClientCredentials -
Run any subsequent commands:
octo-cli -c GetUsersocto-cli -c ImportCk -f "./model.yaml" -w
If the script targets multiple tenants, create one client_credentials client per tenant and switch contexts before each login. The same env-var names work across contexts; the active context determines which tenant the credentials authenticate against.
Backup and Restore
Backup
octo-cli -c Dump -tid "production" -f "./backup.tar.gz"
Restore to a New Tenant
-
Create the target tenant:
octo-cli -c Create -tid "staging" -db "staging_db" -
Grant yourself access:
octo-cli -c ProvisionCurrentUser -ttid "staging" -
Restore from backup:
octo-cli -c Restore `-tid "staging" `-db "staging_db" `-f "./backup-20241213.tar.gz" `-w -
Clear tenant cache:
octo-cli -c ClearCache -tid "staging" -
Re-provision yourself (cache reset may have invalidated previous grant):
octo-cli -c ProvisionCurrentUser -ttid "staging"
See Tenant Lifecycle for detailed backup and restore guidance.
Deploy and Execute a Pipeline
-
Enable communication for the tenant:
octo-cli -c EnableCommunication -
Verify the adapter is connected:
octo-cli -c GetAdapters -
Deploy a pipeline definition — the central Communication Operator picks this up and rolls out the adapter via Helm automatically:
octo-cli -c DeployPipeline `-aid "<adapter-rtId>" `-pid "<pipeline-rtId>" `-f "./my-pipeline.yaml" -
Execute the pipeline:
octo-cli -c ExecutePipeline -id "<pipeline-rtId>" -
Check execution result:
octo-cli -c GetLatestPipelineExecution -id "<pipeline-rtId>" -
Inspect debug points (if debugging is enabled):
octo-cli -c GetPipelineDebugPoints -id "<pipeline-rtId>" -eid "<execution-guid>"
See DataFlows & Pipelines for details on pipeline definitions.