CI/CD
Run Sovaria checks and deploys from CI: credentials, migrations with a dry run first, rules tests and access simulations that fail a pull request, function deploys, environment promotion and an example GitHub Actions workflow.
Credentials
- Create a custom key with the admin role for CI (
sov keys create --name ci --role admin, or Project Settings › API keys) and store it as a repository secret; the CLI reads it fromSOVARIA_API_KEY, with nosov loginstep. Schema changes need the admin role. - Pass
--project(and--orgwhen the key alone doesn't decide it) on every command — linked folders and saved logins are ignored while a key is set. - Never print keys in logs; give each pipeline its own key so you can revoke one alone (API keys).
A pipeline
Check migrations
sov db migrations push --dry-runruns each pending migration in a transaction and rolls it back. Each file is checked on its own, so a pull request with migrations that build on each other is better checked by applying them to staging (Migrations).Check access
sov rules testruns the cases insovaria.rules.test.yaml(start one withsov rules init);sov sim run --fail-on criticalruns a full access simulation and fails on findings at that level. Each uses one policy simulation from the plan's monthly allowance.Deploy
Apply migrations and deploy functions. With an environment, add
--env <environment-id>to deploy to staging and run your integration tests against its URL.Promote
Move staging's changes to production with Deploy to production in the console, which checks everything with nothing written first (Environments, staging and deploying to production). There is no CLI command for it yet. With Staging first on, production changes only this way.
name: sovaria
on: [pull_request, push]
jobs:
checks:
runs-on: ubuntu-latest
env:
SOVARIA_API_KEY: ${{ secrets.SOVARIA_API_KEY }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with: { python-version: "3.12" }
- run: pip install sovaria-cli
- run: sov db migrations push --dry-run --project ${{ vars.SOVARIA_PROJECT_ID }}
- run: sov rules test sovaria.rules.test.yaml --junit rules.xml --project ${{ vars.SOVARIA_PROJECT_ID }}
- run: sov sim run --fail-on critical --project ${{ vars.SOVARIA_PROJECT_ID }}
deploy:
if: github.ref == 'refs/heads/main'
needs: checks
runs-on: ubuntu-latest
env: { SOVARIA_API_KEY: ${{ secrets.SOVARIA_API_KEY }} }
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with: { python-version: "3.12" }
- run: pip install sovaria-cli
- run: sov db migrations push --project ${{ vars.SOVARIA_PROJECT_ID }}
- run: sov fn deploy ./functions/send-receipt --name send-receipt --note "${{ github.sha }}" --project ${{ vars.SOVARIA_PROJECT_ID }}| Free | Pro | Ultra | Team | Enterprise | |
|---|---|---|---|---|---|
| Policy simulations per month | — | 300 | 1,000 | 3,000 | 20,000 |
Every step exits non-zero on failure (1 for a failed request or check, 2 for wrong usage), so the job stops there. Flags for each command: CLI reference.
When a step fails
| Step | Look at |
|---|---|
| Migration dry run | The SQL error printed; fix the migration and push again — nothing was applied. |
| Rules tests | The failing case (who, action, resource, expected vs got); the JUnit report shows it in the pull request. |
| Simulation | The findings listed, or the run in the console under Simulation › History. |
| Function deploy | A failed deploy never replaces the serving version; sov fn versions <name> and sov fn logs <name> show what happened, and sov fn rollback <name> goes back a version. |