Release checks in CI
Run Avrel's release gate in your build pipeline, so a release that breaks a check cannot ship, and record each release once it is deployed. The same command line also imports archived readings.
It works with any CI system that runs Python 3.9 or newer: GitHub Actions, GitLab CI, Jenkins, Buildkite or a shell script. It uses only the standard library.
Set up#
- In Avrel, open Settings > AI assistants and create an agent key. Give it Read access to check releases only, or Operate access to also record releases. Record a release with a key an owner created.
- Store the key as a secret in your CI system, named
AVREL_KEY. Never put it in the repository or a log. - Set
AVREL_URLto your Avrel address, for examplehttps://app.getavrel.com.
Download the command line from your Avrel server in the job, so it always matches the server:
curl -fsSL "$AVREL_URL/deploy/ci/avrel_ci.py" -o avrel_ci.py
Check a release#
python3 avrel_ci.py gate --release v1.4.2 --sha "$GIT_SHA"
This asks the release gate whether that build is safe to ship, as if it were recorded next, without recording it. It prints every check, with what clears a failure, and exits with:
| Exit code | Meaning |
|---|---|
| 0 | The gate approves the release. |
| 1 | The gate blocks the release. Fail the build. |
| 2 | The gate has no checks that can run yet, so it cannot approve. Pass --allow-no-checks while you are setting up. |
| 3 | The key, the address or the server failed. Nothing was decided. |
The checks are the release gate's checks: the safety audit of the declared hardware and the regression checks added from incidents. They check the declared configuration and recorded readings, not the hardware itself.
On GitHub Actions the result is also written to the job summary.
Record a release#
After a deploy, record what is now running, so the release gate page and the audit log show it:
python3 avrel_ci.py record-release --release v1.4.2 --sha "$GIT_SHA" --rollback-sha "$PREVIOUS_SHA"
This needs an Operate key created by an owner.
GitHub Actions example#
name: Release gate
on:
pull_request:
push:
branches: [main]
jobs:
avrel:
runs-on: ubuntu-latest
env:
AVREL_URL: https://app.getavrel.com
AVREL_KEY: ${{ secrets.AVREL_KEY }}
steps:
- name: Get the Avrel command line
run: curl -fsSL "$AVREL_URL/deploy/ci/avrel_ci.py" -o avrel_ci.py
- name: Is this release safe to ship?
run: python3 avrel_ci.py gate --release "${{ github.ref_name }}" --sha "${{ github.sha }}"
- name: Record the release
if: github.event_name == 'push'
run: python3 avrel_ci.py record-release --release "${{ github.ref_name }}" --sha "${{ github.sha }}"
Put the record step after your deploy step, so Avrel only records what really shipped.
Import history from the command line#
python3 avrel_ci.py import readings.csv --source "logger export 2026"
This loads archived readings as history, in the format described in Import history. It needs an Operate key created by an owner. Files can be gzipped, and large files are sent in parts of 5,000 readings. Importing a file again stores nothing new.
To import an export with other column names, map them. For example, an InfluxDB annotated CSV export where measure holds the reading's name:
python3 avrel_ci.py import influx_2026-10-01.csv.gz --unit-id CELL-4 \
--time-column _time --value-column _value --name-column measure --unit-of-measure-column _measurement
Lines starting with # are skipped. Use --dry-run to count the readings without sending them.
Everything is recorded#
Each call goes through the same checks as the app and is written to the audit log, with the key's name. A key only reaches its own organization.