# CI and retries

## Authenticate in CI

Store the key as a secret and expose it as `RUNCOMPUTE_API_KEY`. No login step
is needed.

```yaml
# .github/workflows/nightly-eval.yml
jobs:
  eval:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with: { python-version: "3.12" }
      - run: pip install https://runcompute.cloud/sdk/runcompute-0.2.0-py3-none-any.whl
      - run: runcompute run eval.toml
        env:
          RUNCOMPUTE_API_KEY: ${{ secrets.RUNCOMPUTE_API_KEY }}
```

`runcompute run` exits with `0` when the job succeeds and `1` otherwise, so the
CI step fails with the job.

## Retries

The client retries requests that fail with a network error or a 5xx response,
twice by default, with a short backoff. Set `max_retries=` on `Client` to
change it.

A retried *submission* can create a second job if the first request reached
the server. When a submit fails with a network error, run `runcompute list
active` before submitting again.
