CI/CD usage
Use edge in automated pipelines without interactive prompts.
The edge CLI is designed to work in non-interactive environments — GitHub Actions, GitLab CI, CircleCI, and any other pipeline that runs commands without a TTY.
How the CLI detects CI mode
The CLI checks whether stdin is a terminal:
term.IsTerminal(int(os.Stdin.Fd()))When stdin is not a terminal (i.e. in a CI runner), all interactive prompts are disabled. Every required value must be supplied via a flag, environment variable, or .edge.json link file. If a required value is missing the CLI exits with a clear error message.
Authentication in CI
Set the CLOUD_TOKEN environment variable instead of running edge auth login:
export CLOUD_TOKEN=<token>Generate a token scoped to the project and environment you need:
# Run once, locally
edge token create "GitHub Actions" --env production
# Save the printed token to your CI secrets vaultProviding context
Every command that needs a workspace, project, or environment must get those values from one of:
- Flags —
--workspace,--project,--env .edge.json— commit a.edge.jsonto your repo root~/.simplifyd/config.json— not useful in ephemeral CI environments
The --json flag makes output machine-parseable:
edge deploy up api \
--workspace acme-corp \
--project payments \
--env production \
--jsonGitHub Actions example
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install edge CLI
run: go install github.com/simplifyd-systems/cloud-cli/cmd/edge@latest
- name: Deploy API
env:
CLOUD_TOKEN: ${{ secrets.CLOUD_TOKEN }}
run: |
edge deploy up api \
--workspace ${{ vars.WORKSPACE }} \
--project ${{ vars.PROJECT }} \
--env production \
--jsonGitLab CI example
deploy:
stage: deploy
image: golang:1.22
script:
- go install github.com/simplifyd-systems/cloud-cli/cmd/edge@latest
- edge deploy up api
--workspace $WORKSPACE
--project $PROJECT
--env production
--json
variables:
CLOUD_TOKEN: $CLOUD_TOKEN
only:
- mainUsing .edge.json to reduce flag repetition
Commit a .edge.json to your repository root to avoid repeating --workspace, --project, and --env on every command:
{
"workspace": "acme-corp",
"project": "payments",
"env": "production"
}Your pipeline then becomes:
CLOUD_TOKEN=$SECRET edge deploy up api --jsonDeploying multiple services
for svc in api worker scheduler; do
echo "Deploying $svc..."
CLOUD_TOKEN=$SECRET edge deploy up $svc \
--workspace acme-corp --project payments --env production --json
doneSetting variables from CI
CLOUD_TOKEN=$SECRET edge variables set \
DATABASE_URL=$DB_URL \
REDIS_URL=$REDIS_URL \
--workspace acme-corp --project payments --env productionChecking deployment status
The --json flag lets you pipe output to jq for scripting:
STATUS=$(CLOUD_TOKEN=$SECRET edge deploy list api \
--workspace acme-corp --project payments --env production --json \
| jq -r '.[0].status')
echo "Latest deployment status: $STATUS"Exit codes
edge exits with:
| Code | Meaning |
|---|---|
0 | Success |
1 | Error (API error, missing required flag, auth failure, etc.) |