You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: jekyll/_cci2/contexts.md
+11
Original file line number
Diff line number
Diff line change
@@ -124,6 +124,17 @@ Environment variables are used according to a specific precedence order, as foll
124
124
125
125
Environment variables declared inside a shell command `run step`, for example `FOO=bar make install`, will override environment variables declared with the `environment` and `contexts` keys. Environment variables added on the Contexts page will take precedence over variables added on the Project Settings page. Finally, special CircleCI environment variables are loaded.
126
126
127
+
## Secrets Masking
128
+
129
+
Contexts hold project secrets or keys that perform crucial functions for your applications. For added security CircleCI performs secret masking on the build output, obscuring the `echo` or `print` output of contexts.
130
+
131
+
The value of the context will not be masked in the build output if:
132
+
133
+
* the value of the contex is less than 4 characaters
134
+
* the value of the context is equal to one of `true`, `True`, `false` or `False`
135
+
136
+
**Note:** secret masking will only prevent the value of the context from appearing in your build output. The value of the context is still accessible to users [debugging builds with SSH]({{ site.baseurl }}/2.0/ssh-access-jobs).
Copy file name to clipboardExpand all lines: jekyll/_cci2/env-vars.md
+18-3
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,19 @@ This document describes using environment variables in CircleCI in the following
15
15
## Overview
16
16
{:.no_toc}
17
17
18
-
To add private keys or secret environment variables to your private project, use the Environment Variables page of the Build > Project > Settings in the CircleCI application. The value of the variables are neither readable nor editable in the app after they are set. To change the value of an environment variable, delete the current variable and add it again with the new value. It is possible to add individual variables or to import variables from another project. Private environment variables enable you to store secrets safely even when your project is public, see [Building Open Source Projects]({{ site.baseurl }}/2.0/oss/) for associated settings information. Use Contexts to further restrict access to environment variables from within the build, refer to the [Restricting a Context]({{ site.baseurl }}/2.0/contexts/#restricting-a-context) documentation.
18
+
To add private keys or secret environment variables to your private project, use the Environment Variables page of the Build > Project > Settings in the CircleCI application. The value of the variables are neither readable nor editable in the app after they are set. To change the value of an environment variable, delete the current variable and add it again with the new value. It is possible to add individual variables or to import variables from another project. Private environment variables enable you to store secrets safely even when your project is public, see [Building Open Source Projects]({{ site.baseurl }}/2.0/oss/) for associated settings information. Use Contexts to further restrict access to environment variables from within the build, refer to the [Restricting a Context]({{ site.baseurl }}/2.0/contexts/#restricting-a-context) documentation.
19
+
20
+
### Secrets Masking
21
+
{:.no_toc}
22
+
23
+
Environment variables may hold project secrets or keys that perform crucial functions for your applications. For added security CircleCI performs secret masking on the build output, obscuring the `echo` or `print` output of environment variables and contexts.
24
+
25
+
The value of the environment variable will not be masked in the build output if:
26
+
27
+
* the value of the environment variable is less than 4 characaters
28
+
* the value of the environment variable is equal to one of `true`, `True`, `false` or `False`
29
+
30
+
**Note:** secret masking will only prevent the value of the environment variable from appearing in your build output. The value of the environment variable is still accessible to users [debugging builds with SSH]({{ site.baseurl }}/2.0/ssh-access-jobs).
19
31
20
32
### Environment Variable Usage Options
21
33
{:.no_toc}
@@ -66,19 +78,21 @@ jobs: # basic units of work in a run
66
78
command: echo ${CIRCLE_BRANCH}
67
79
# Run another step, the same as above; note that you can
68
80
# invoke environment variable without curly braces.
81
+
# prints: XXXXXXX
69
82
- run:
70
83
name: "What branch am I on now?"
71
-
command: echo $CIRCLE_BRANCH
84
+
command: echo $CIRCLE_BRANCH# prints: XXXXXXX
72
85
- run:
73
86
name: "What was my custom environment variable?"
74
-
command: echo ${MY_ENV_VAR}
87
+
command: echo ${MY_ENV_VAR}# prints: XXXXXXX
75
88
```
76
89
77
90
The above `config.yml` demonstrates the following:
78
91
79
92
- Setting custom environment variables
80
93
- Reading a built-in environment variable that CircleCI provides (`CIRCLE_BRANCH`)
81
94
- How variables are used (or interpolated) in your `config.yml`
95
+
- Masking of printed environment variables (secrets masking)
82
96
83
97
When the above config runs, the output looks like this:
84
98
@@ -386,3 +400,4 @@ Variable | Type | Value
386
400
{:.no_toc}
387
401
388
402
[Contexts]( {{ site.baseurl }}/2.0/contexts/)
403
+
[Keep environment variables private with secret masking](https://circleci.com/blog/keep-environment-variables-private-with-secret-masking/)
0 commit comments