Skip to content

Commit 74348e8

Browse files
authored
Merge pull request #3474 from travis-ci/DU-32/acct-env-var
Du 32/acct env var
2 parents cd59131 + 25740ca commit 74348e8

File tree

4 files changed

+47
-0
lines changed

4 files changed

+47
-0
lines changed

_includes/sidebar.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ <h3>CI Environment Reference</h3>
7979
<li><a href="/user/multi-os/">Building on Multiple Operating Systems</a></li>
8080
<li><a href="/user/multi-cpu-architectures/">Building on Multiple CPU Architectures</a></li>
8181
<li><a href="/user/environment-variables/">Environment Variables</a></li>
82+
<li><a href="/user/environment-variables/">Account Environment Variables</a></li>
8283
<li><a href="/user/build-environment-updates/">Build Environment Updates</a></li>
8384
<li><a href="/user/ip-addresses/">Build Machines IP Addresses</a></li>
8485
</ul>

user/account-environment-variable.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: Account Environment Global Variables
3+
layout: en
4+
5+
---
6+
7+
## Define Account Environment Global Variables
8+
9+
Travis CI allows you to create Account Environment variables, which can be used in every build under the account's enabled repositories.
10+
11+
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.
12+
13+
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.
14+
15+
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.
16+
17+
### Using Account Variables in Forked Repositories
18+
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.
19+
The global environment variables are unavailable in the PR build because, for security reasons, they are not shared with the forked repository.
20+
21+
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.
22+
23+
## Add Account Variables
24+
25+
Add new account environment variables by following these easy steps:
26+
1. Log in to your [Travis CI account](https://app.travis-ci.com/signin), and under your profile icon, select Settings.
27+
2. Navigate to the Settings tab and scroll to the Account Environment Variables section.
28+
3. Add new variables by filling out the required fields.
29+
- **Name**: Select a name for the account environment variable.
30+
- **Value**: Enter the value for the account environment variable.
31+
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]*.
32+
5. Once all fields are filled, click the **Add New Variable** button.
33+
34+
![Account Variable Screen](/user/images/acct-env-var.png)
35+
36+
After adding a variable, the secret is masked and added to the list of existing variables.
37+
38+
> 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).
39+
40+
## Delete an Account Variable
41+
42+
An account variable can be deleted with the Delete option to the right of each key.
43+
44+
Builds no longer have access to deleted variables.
45+
46+
![Account Variable secret](/user/images/account-var-secret.png)

user/images/account-var-secret.png

3.9 KB
Loading

user/images/acct-env-var.png

42.9 KB
Loading

0 commit comments

Comments
 (0)