Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
3746d546
Commit
3746d546
authored
Mar 02, 2021
by
Suzanne Selhorn
Committed by
Marcel Amirault
Mar 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarified environment variables
Related to:
https://gitlab.com/gitlab-org/gitlab/-/issues/300312
parent
0409b5fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
33 deletions
+41
-33
doc/ci/yaml/README.md
doc/ci/yaml/README.md
+41
-33
No files found.
doc/ci/yaml/README.md
View file @
3746d546
...
@@ -2428,10 +2428,7 @@ Soon GitLab Runner picks up and starts the job.
...
@@ -2428,10 +2428,7 @@ Soon GitLab Runner picks up and starts the job.
### `environment`
### `environment`
Use
`environment`
to define the
[
environment
](
../environments/index.md
)
that a job deploys to.
Use
`environment`
to define the
[
environment
](
../environments/index.md
)
that a job deploys to.
If
`environment`
is specified and no environment under that name exists, a new
For example:
one is created automatically.
In its simplest form, the
`environment`
keyword can be defined like:
```
yaml
```
yaml
deploy to production
:
deploy to production
:
...
@@ -2440,34 +2437,20 @@ deploy to production:
...
@@ -2440,34 +2437,20 @@ deploy to production:
environment
:
production
environment
:
production
```
```
In the above example, the
`deploy to production`
job is marked as doing a
You can assign a value to the
`environment`
keyword by using:
deployment to the
`production`
environment.
#### `environment:name`
The
`environment: name`
keyword can use any of the defined CI/CD
[
variables
](
#variables
)
,
-
Plain text, like
`production`
.
including predefined, secure, or variables defined in the
`.gitlab-ci.yml`
file.
-
Variables, including CI/CD variables, predefined, secure, or variables
defined in the
`.gitlab-ci.yml`
file.
You can't use variables defined in a
`script`
section.
You can't use variables defined in a
`script`
section.
The
`environment`
name can contain:
If you specify an
`environment`
and no environment with that name exists,
an environment is created.
-
letters
-
digits
-
spaces
-
`-`
-
`_`
-
`/`
-
`$`
-
`{`
-
`}`
Common names are
`qa`
,
`staging`
, and
`production`
, but you can use whatever
#### `environment:name`
name works with your workflow.
Instead of defining the name of the environment right after the
`environment`
Set a name for an
[
environment
](
../environments/index.md
)
. For example:
keyword, it's also possible to define it as a separate value. For that, use
the
`name`
keyword under
`environment`
:
```
yaml
```
yaml
deploy to production
:
deploy to production
:
...
@@ -2477,18 +2460,32 @@ deploy to production:
...
@@ -2477,18 +2460,32 @@ deploy to production:
name
:
production
name
:
production
```
```
#### `environment:url`
Common environment names are
`qa`
,
`staging`
, and
`production`
, but you can use any
name you want.
You can assign a value to the
`name`
keyword by using:
The
`environment:url`
keyword can use any of the defined CI/CD
[
variables
](
#variables
)
,
-
Plain text, like
`staging`
.
including predefined, secure, or variables defined in the
`.gitlab-ci.yml`
file.
-
Variables, including CI/CD variables, predefined, secure, or variables
defined in the
`.gitlab-ci.yml`
file.
You can't use variables defined in a
`script`
section.
You can't use variables defined in a
`script`
section.
Th
is optional value exposes buttons that take you to the defined URL
Th
e environment
`name`
can contain:
In this example, if the job finishes successfully, it creates buttons
-
Letters
in the merge requests and in the environments/deployments pages that point
-
Digits
to
`https://prod.example.com`
.
-
Spaces
-
`-`
-
`_`
-
`/`
-
`$`
-
`{`
-
`}`
#### `environment:url`
Set a URL for an
[
environment
](
../environments/index.md
)
. For example:
```
yaml
```
yaml
deploy to production
:
deploy to production
:
...
@@ -2499,6 +2496,17 @@ deploy to production:
...
@@ -2499,6 +2496,17 @@ deploy to production:
url
:
https://prod.example.com
url
:
https://prod.example.com
```
```
After the job completes, you can access the URL by using a button in the merge request,
environment, or deployment pages.
You can assign a value to the
`url`
keyword by using:
-
Plain text, like
`https://prod.example.com`
.
-
Variables, including CI/CD variables, predefined, secure, or variables
defined in the
`.gitlab-ci.yml`
file.
You can't use variables defined in a
`script`
section.
#### `environment:on_stop`
#### `environment:on_stop`
> - [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/22191) in GitLab 8.13.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/22191) in GitLab 8.13.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment