Skip to content

Du 32/acct env var #3474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _includes/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ <h3>CI Environment Reference</h3>
<li><a href="/user/multi-os/">Building on Multiple Operating Systems</a></li>
<li><a href="/user/multi-cpu-architectures/">Building on Multiple CPU Architectures</a></li>
<li><a href="/user/environment-variables/">Environment Variables</a></li>
<li><a href="/user/environment-variables/">Account Environment Variables</a></li>
<li><a href="/user/build-environment-updates/">Build Environment Updates</a></li>
<li><a href="/user/ip-addresses/">Build Machines IP Addresses</a></li>
</ul>
Expand Down
46 changes: 46 additions & 0 deletions user/account-environment-variable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: Account Environment Global Variables
layout: en

---

## Define Account Environment Global Variables

Travis CI allows you to create Account Environment variables, which can be used in every build under the account's enabled repositories.

Account-level variables work similarly to repository-level settings; they can customize your builds and set a list of environment variables and values to be reused across projects. Account environment variables can be used across different repositories. Any account environment variables created are accessible in all available repositories unless explicitly overridden.

When an account-level variable is created with the same name as an existing repository-level variable, the build log displays the repository-level value instead of the account-level value. This is because the repository-level variable overrides the account-level variable.

Global environment variables are available to all repositories under the account but cannot be shared with forked repositories. Therefore, global environment variables are unavailable when attempting a Pull Request from a forked repository to the base repository.

### Using Account Variables in Forked Repositories
When a PR is created from a forked repository to the base repository, global environment variables defined in the base repository are not available in the PR's build environment.
The global environment variables are unavailable in the PR build because, for security reasons, they are not shared with the forked repository.

Therefore, the base repository should clone the global environment variables to the repository level so that the PR build from a forked repository succeeds. This is because repository-level environment variables defined in the base repository are available in the PR's build environment.

## Add Account Variables

Add new account environment variables by following these easy steps:
1. Log in to your [Travis CI account](https://app.travis-ci.com/signin), and under your profile icon, select Settings.
2. Navigate to the Settings tab and scroll to the Account Environment Variables section.
3. Add new variables by filling out the required fields.
- **Name**: Select a name for the account environment variable.
- **Value**: Enter the value for the account environment variable.
4. If desired, enable the **Display Value in Build Log** switch. If enabled, the value is visible in the logs. If disabled, it is marked as *“[secure]”*.
5. Once all fields are filled, click the **Add New Variable** button.

![Account Variable Screen](/user/images/acct-env-var.png)

After adding a variable, the secret is masked and added to the list of existing variables.

> Note: Using account-level variables can pose a security risk. Read our documentation for secure tips on [generating private keys](/user/best-practices-security#recommendations-on-how-to-avoid-leaking-secrets-to-build-logs).

## Delete an Account Variable

An account variable can be deleted with the Delete option to the right of each key.

Builds no longer have access to deleted variables.

![Account Variable secret](/user/images/account-var-secret.png)
Binary file added user/images/account-var-secret.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added user/images/acct-env-var.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.