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
556aaebc
Commit
556aaebc
authored
Nov 17, 2016
by
Achilleas Pipinellis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish "Stopping envs" and "Grouping similar envs" sections
[ci skip]
parent
54fc574e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
27 deletions
+56
-27
doc/ci/environments.md
doc/ci/environments.md
+56
-27
doc/ci/img/environments_dynamic_groups.png
doc/ci/img/environments_dynamic_groups.png
+0
-0
No files found.
doc/ci/environments.md
View file @
556aaebc
...
...
@@ -273,9 +273,9 @@ Last but not least, we tell the job to run [`only`][only] on branches
[
`except`
][
only
]
master.
>**Note:**
You are not bound to use
only slashes in the dynamic environments' names (
`/`
),
but as we will see later, this will enable the "grouping similar environments"
feature.
You are not bound to use
the same prefix or only slashes in the dynamic
environments' names (
`/`
), but as we will see later, this will enable the
[
grouping similar environments
](
#grouping-similar-environments
)
feature.
The whole
`.gitlab-ci.yml`
looks like this so far:
...
...
@@ -388,31 +388,74 @@ and finally manually deployed to the production server. What we just described
is a single workflow, but imagine tens of developers working on a project
at the same time. They each push to their branches, and dynamic environments are
created all the time. In that case, we probably need to do some clean up. Read
next how environments can be
clos
ed.
next how environments can be
stopp
ed.
##
Clos
ing an environment
##
Stopp
ing an environment
```
review:
By stopping an environment, you are effectively terminating its recording of the
deployments that happen in it.
>**Note:**
Starting with GitLab 8.14, dynamic environments will be stopped automatically
when their associated branch is removed.
There is a special case where environments can be manually closed. That can
happen if you provide another job for that matter. The syntax is a little
tricky since a job calls another job to do the job.
Consider the following example where the
`deploy_review`
calls the
`stop_review`
to clean up and stop the environment:
```
yaml
deploy_review
:
stage
:
deploy
script
:
-
rsync -av --delete public /srv/nginx/pages/$CI_BUILD_REF_NAME
-
echo "Deploy a review app"
environment
:
name
:
review/$CI_BUILD_REF_NAME
url: http
://$CI_BUILD_REF_NAME.$APPS_DOMAIN
url
:
http
s://$CI_BUILD_REF_NAME.example.com
on_stop
:
stop_review
only
:
-
branches
except
:
-
master
stop_review
:
script: rm -rf /srv/nginx/pages/$CI_BUILD_REF_NAME
script
:
-
echo "Remove review app"
when
:
manual
environment
:
name
:
review/$CI_BUILD_REF_NAME
action
:
stop
```
You can read more in the
[
`.gitlab-ci.yml` reference
][
onstop
]
.
## Grouping similar environments
folders in environments page
> [Introduced][ce-7015] in GitLab 8.14.
As we've seen in the
[
dynamic environments
](
#dynamic-environments
)
, you can
In short, environments that are named like
`type/foo`
are presented under a
group named
`type`
.
In our minimal example, we name the environments
`review/$CI_BUILD_REF_NAME`
where
`$CI_BUILD_REF_NAME`
is the branch name:
```
yaml
deploy_review
:
stage
:
deploy
script
:
-
echo "Deploy a review app"
environment
:
name
:
review/$CI_BUILD_REF_NAME
```
In that case, if you visit the Environments page, and provided the branches
exist, you should see something like:
![
Environment groups
](
img/environments_dynamic_groups.png
)
## Checkout deployments locally
...
...
@@ -435,22 +478,6 @@ Below are some links you may find interesting:
-
[
A blog post on Deployments & Environments
](
https://about.gitlab.com/2016/08/26/ci-deployment-and-environments/
)
-
[
Review Apps
](
review_apps.md
)
Expand dynamic environments to deploy your code for every branch
## TODO
Actions
-
View environments +
-
View deployments +
-
Rollback deployments +
-
Run deployments +
-
View link to environment URL
-
View last commit message of deployment +
-
View person who performed the deployment +
-
View commit SHA that triggered the deployment +
-
View branch the deployment was based on +
-
View time ago the deployment was performed +
[
Pipelines
]:
pipelines.md
[
jobs
]:
yaml/README.md#jobs
[
yaml
]:
yaml/README.md
...
...
@@ -460,3 +487,5 @@ Actions
[
variables
]:
variables/README.md
[
env-name
]:
yaml/README.md#environment-name
[
only
]:
yaml/README.md#only-and-except
[
onstop
]:
yaml/README.md#environment-on_stop
[
ce-7015
]:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7015
doc/ci/img/environments_dynamic_groups.png
0 → 100644
View file @
556aaebc
131 KB
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