Environment variables
Environment variables supply configuration and credentials to repository builds and session processes. Organization variables provide defaults across repositories; a repository variable with the same name overrides the organization variable.
Secret variables are hidden after saving, but their values are still available to processes in the scopes you select. For HTTP credentials that must stay outside the sandbox, use egress secrets.
Permissions
- Repository variables: viewing requires the View repositories, Add repositories, or Edit repositories role. Changing them requires the Edit repositories role.
- Organization variables: viewing and changing both require the Manage secrets role.
Read-only users cannot change variables. See Users and roles for role assignment.
Add variables
- For a repository variable, open Repositories, select the repository, and choose Environment variables. For a shared variable, open Environment → Variables.
- Enter the variable name and value.
- Select Build, Runtime, or both, and choose Secret or Plain text.
- Save your changes.
New variables default to Secret with Build scope. Add Runtime when the agent's session processes need the variable.
- Build: available to setup commands that create the repository image.
- Runtime: available to processes in the session sandbox, including session setup scripts.
A repository variable overrides an organization variable by name, even when their scopes differ. For example, if an organization variable has both scopes and its repository override has only Build, the organization value does not fill in Runtime. Give the override every scope you need.
Secret and Plain text
Inspect encrypts both types in storage. Plain text values can be read back in settings; Secret values are omitted when Inspect returns the saved variable list. Leaving an existing Secret's value unchanged preserves its stored value.
You can convert Plain text to Secret. A saved Secret stays Secret in the editor; to make it Plain text, remove it and add it again. Build scripts can write variable values into image files, so a Secret setting does not by itself prevent credentials from being persisted by your scripts.
Bulk changes
Paste multiple .env assignments into a variable name field to add them together. Pasted names that already exist update those values; new names default to Secret with Build scope. Review the scopes before saving.
Select variables to use Edit scopes, Make secret, or Delete across the selection. Changes remain a draft until you save them.
Limits and reserved names
- Name: 1 to 200 characters; letters, digits, and underscores; cannot start with a digit.
- Value: up to 64,000 characters.
- Scopes: at least one of Build or Runtime.
- Save request: up to 500 additions or updates and 500 deletions.
Inspect rejects reserved names with “This environment variable name is reserved.” You cannot update and delete the same name in one request.
When changes take effect
Saving repository variables supersedes an active build and starts a replacement repository build. The current image normally stays published until the new image is ready. Deleting a variable or updating an existing Secret invalidates the old image at once, since a script may have written the previous value into it.
Organization variable changes do not start builds across all repositories. Future builds resolve the updated organization values.
If a variable is missing during session setup, check Runtime scope and whether a repository override hides the organization value. A Build-only variable is not supplied as a runtime environment variable.