Use the CLI in scripts and CI
Authenticate the Sliplane CLI with an API key, read JSON output, and deploy from CI pipelines.
The Sliplane CLI works in scripts and CI pipelines as well as in your terminal. Outside a terminal it never prompts, so every choice must come from flags or your configuration.
Authenticate with an API key
Create an API key and set it as SLIPLANE_TOKEN. The CLI uses it instead of a saved login:
export SLIPLANE_TOKEN=yourapikeyhere
sliplane auth statusGive the key only the permissions the job needs. A pipeline that only redeploys a service, for example, needs Write on Services. Commands that change resources need write access.
You can also pass --token, but an environment variable keeps the key out of your shell history and process list.
Read JSON output
Add -o json to any command for structured output:
sliplane service list -o json
sliplane logs api --follow -o json # one JSON object per lineTo use JSON by default, run sliplane config set output json.
Confirm changes without prompts
Commands that delete resources ask for confirmation in a terminal. In scripts, pass --yes to confirm. Pass names and IDs explicitly, for example with --project and --server, so the CLI does not have to choose.
Deploy from GitHub Actions
This workflow installs the CLI and redeploys an image-based service with the image tag of the current commit. Store your API key as the SLIPLANE_TOKEN secret in your repository's Actions settings.
name: Deploy to Sliplane
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Install the Sliplane CLI
run: |
curl -fsSL https://sliplane.io/install.sh | sh
echo "$HOME/.sliplane/bin" >> "$GITHUB_PATH"
- name: Redeploy the service
env:
SLIPLANE_TOKEN: ${{ secrets.SLIPLANE_TOKEN }}
run: sliplane service redeploy api --project production --tag ${{ github.sha }}Replace api and production with your service and project. Build and push the image before this step, as shown in the GitHub Actions guide. For a repository-based service, drop --tag.
service redeploy returns once Sliplane accepts the deployment. Use sliplane service events api or sliplane logs api to follow its progress.
Pin a version
The installer installs the latest release by default. To install a specific version, pass it to the script:
curl -fsSL https://sliplane.io/install.sh | sh -s -- 0.8.0The CLI also updates itself in the background. Set SLIPLANE_NO_AUTO_UPDATE=1 to keep the pinned version.
How is this guide?