Using Locally with Other CI Tools

Preview

During Public Preview you can use the Team plan for free, and get an early-adopter discount at GA. Sign in

Using Locally with Other CI Tools

If you're not using GitHub Actions, GitLab CI or Azure DevOps, you can still run Locally in any CI environment by configuring it manually. You'll need an OIDC token from your CI provider (or a pre-obtained one) and the environment variables documented below.

You'll need either an OIDC trust (recommended) or a CI Key, both covered below.

Environment Variables

The following Environment Variables are used to configure CI mode:

  • LOCALLY_CI_KEY - A CI Key, if you're not using an OIDC token.
  • LOCALLY_CI_KEY_FILE - Path to a file containing a CI Key, instead of LOCALLY_CI_KEY.
  • LOCALLY_TEAM_UUID - The UUID of your Locally team, if your OIDC trust belongs to a Team.
  • LOCALLY_USER_UUID - The UUID of your Locally user, if your OIDC trust belongs to your User. Set either this or LOCALLY_TEAM_UUID, not both. Neither is needed with a CI Key, which already says which Team or user it belongs to.
  • LOCALLY_TLS_CA_FILE_PATH - Specifies the path to the local Certificate Authority.
  • LOCALLY_TLS_CERT_FILE_PATH - Specifies the path to the TLS Certificate.
  • LOCALLY_TLS_KEY_FILE_PATH - Specifies the path to the Private Key.
  • LOCALLY_WORKING_DIRECTORY - Specifies a working directory that Locally can write temporary files to. If you're not sure, you should be able to use $TMPDIR on macOS/Linux and %TEMP% on Windows.
  • LOCALLY_OIDC_TOKEN (optional) - An OIDC token for authentication with a custom provider.
  • LOCALLY_OIDC_TOKEN_FILE (optional) - Path to a file containing an OIDC token.

The TLS material must be valid for the full set of domains Locally serves locally - you can get an up-to-date list by running locally certificate get-required-domains.

Workload Identity Federation (Team and User OIDC)

Note

Workload Identity Federation is the recommended way to run Locally in CI, since there's no long-lived secret to store, rotate or leak.

With Workload Identity Federation, your CI system issues a short-lived OIDC token for each job, and Locally trusts tokens from it. Set up an OIDC trust in your Locally Account, either for yourself (Account -> Personal CI (OIDC)) or for your Team (Teams -> [name] -> Team CI (OIDC)), as described in Using Locally in CI.

Then give the job its token, either as LOCALLY_OIDC_TOKEN or in a file named by LOCALLY_OIDC_TOKEN_FILE, and set LOCALLY_TEAM_UUID for a Team trust or LOCALLY_USER_UUID for your own.

CI Keys

Some CI systems can't issue OIDC tokens - such as Bamboo, AWS CodeBuild, or Jenkins without its OpenID Connect plugin. For those, locally ci can sign in with a CI Key instead.

Heads up

A CI Key is a long-lived secret, so use OIDC wherever your CI system supports it.

Create one in your Locally Account, either for yourself (Account -> Personal CI Keys) or, as a Team admin, for your Team (Teams -> [name] -> Team CI Keys). Give it a name, and choose when it expires: in 90, 180 or 365 days, or never.

The key is only shown once, so copy it straight into your CI system's secret store and give it to the job as LOCALLY_CI_KEY (or write it to a file and set LOCALLY_CI_KEY_FILE). Then run locally ci as below - you don't need LOCALLY_TEAM_UUID or LOCALLY_USER_UUID.

locally ci warns when a key is within 14 days of expiring. To replace one, choose Rotate next to it: the old key keeps working until you revoke it, so you can update the secret in your CI system first.

A Team, or the organisation it belongs to, can turn off Allow CI Keys in its settings to require OIDC. While it's off, existing keys stop working and new ones can't be created.

Launching CI Mode

Once you've configured your OIDC trust or CI Key and set the required environment variables, launch CI mode by running:

$ locally ci

Once Locally has been launched in CI mode, it will output a JSON payload with the endpoints:

{
  "endpoints": {
    "atlas": "https://127.0.0.1:5679",
    "author": "https://127.0.0.1:5677",
    "controlPlane": "https://127.0.0.1:5680",
    "termination": "https://127.0.0.1:5674/_locally/ci/terminate"
  },
  "information": {
    "launch-time": "2025-04-06T12:14:07Z",
    "product": "locally",
    "version": "0.0.1"
  }
}

Using Locally Run in CI Mode

Once CI mode is running, use locally run to execute commands through the Locally environment:

$ locally run az group create -n hello-from-ci -l berlin

Stopping CI Mode

When your pipeline is complete, stop CI mode to release resources:

$ locally ci --stop

See Using Locally in CI for session limits, exit codes and the ports/endpoints Locally needs access to.

Next steps

The Automation API lets your pipeline look up Locally's endpoints and stop it over HTTP. If your OIDC Trust belongs to a Team, Locally uses the same Locally Runbooks as the rest of your team.

Should you encounter any issues, please take a look at the troubleshooting section, reach out in our Discord or open an issue and we'll take a look.

Preview

During Public Preview you can use the Team plan for free, and get an early-adopter discount at GA. Sign in

A local cloud for you and your AI agents.

Your Azure infrastructure, running on your machine. Deploy in seconds, break things freely, and ship to Azure when you're ready.