As another example, let's say you're using your own GitLab
instance and you want to know what domain your GitLab Pages are
served under. You can call it by using the predefined
variable `$CI_PAGES_DOMAIN` in your script:
```yaml
pages:
script:
-...
-echo $CI_PAGES_DOMAIN
```
For GitLab.com users, the output is `gitlab.io`. For your
private instance, the output is whatever your sysadmin has
defined.
## Custom environment variables
When you need a specific custom environment variable, you can
...
...
@@ -181,8 +166,8 @@ You can use tools like [the AWS CLI](https://docs.aws.amazon.com/cli/latest/user
and [`kubectl`](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#the-kubeconfig-environment-variable)
to customize your configuration by using **File** type variables.
In the past, a common pattern was to read the value of a CI variable, save it in a file, and then
use the newly created file in your script:
Previously, a common pattern was to read the value of a CI variable, save it in a file, and then
use that file in your script:
```shell
# Read certificate stored in $KUBE_CA_PEM variable and save it in a new file
...
...
@@ -288,11 +273,11 @@ job_name:
### PowerShell
To access environment variables in a **Windows PowerShell** environment, prefix
the variable name with (`$env:`). For environment variables set by GitLab CI, including those set by [`variables`](https://gitlab.com/gitlab-org/gitlab/blob/master/doc/ci/yaml/README.md#variables)
parameter, they can also be accessed by prefixing the variable name with (`$`)
as of [GitLab Runner 1.0.0](https://gitlab.com/gitlab-org/gitlab-runner/-/commit/abc44bb158008cd3a49c0d8173717c38dadb29ae#47afd7e8f12afdb8f0246262488f24e6dd071a22).
System set environment variables however must be accessed using (`$env:`).
To access variables in a **Windows PowerShell** environment, including system set
environment variables, prefix the variable name with (`$env:`). Environment variables
set by GitLab CI can also be accessed by prefixing the variable name with (`$`) with