Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
8666fd76
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8666fd76
编写于
11月 04, 2016
作者:
A
Achilleas Pipinellis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Begin writing Overview section
上级
6715091b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
89 deletion
+30
-89
doc/ci/environments.md
doc/ci/environments.md
+28
-29
doc/ci/yaml/README.md
doc/ci/yaml/README.md
+2
-60
未找到文件。
doc/ci/environments.md
浏览文件 @
8666fd76
...
...
@@ -3,20 +3,38 @@
>**Note:**
Introduced in GitLab 8.9.
During the development of a software there can be many stages until it's ready
for public consumption. You sure want to first see your code in a testing or
staging environment before you release it to the public. That way you can
prevent bugs not only in your software, but in the deployment process as well.
With environments you can control the Continuous Deployment of your software all
During the development of a software, there can be many stages until it's ready
for public consumption. You sure want to first test your code and then deploy it
in a testing or staging environment before you release it to the public. That
way you can prevent bugs not only in your software, but in the deployment
process as well.
In case you use GitLab CI to not only test or build your project, but also
deploy it in your infrastructure, GitLab provides a way to track your deployments
so you always know what is currently being deployed on your servers. With
environments you can control the Continuous Deployment of your software all
within GitLab. All you need to do is define them in your project's
[
`.gitlab-ci.yml`
][
yaml
]
.
[
`.gitlab-ci.yml`
][
yaml
]
. GitLab provides a full history of your deployments per
every environment.
## Overview
Deployments are created when [jobs] deploy versions of code to environments,
so every environment can have one or more deployments. GitLab keeps track of
your deployments, so you always know what is currently being deployed on your
servers.
Environments are like tags for your CI jobs, describing where code gets deployed.
CI/CD [Pipelines] usually have one or more [jobs] that deploy to an environment.
You can think of names such as testing, staging or production.
In the following sections, we'll see how that works.
Defining environments in a project's
`.gitlab-ci.yml`
lets developers track
[deployments] to these environments.
## An environments example
The environments page can only be viewed by Reporters and above. For more
information on the permissions, see the
[
permissions documentation
][
permissions
]
.
Let's assume that you have
Let's assume that you have
:
1.
Define the environments in
`.gitlab-ci.yml`
1.
Push the repository to GitLab
...
...
@@ -41,18 +59,6 @@ View commit SHA that triggered the deployment
View branch the deployment was based on
View time ago the deployment was performed
Environments are like tags for your CI jobs, describing where code gets deployed.
You can think of names such as testing, staging or production.
CI/CD [Pipelines] usually have one or more [jobs] that deploy to an environment.
Defining environments in a project's
`.gitlab-ci.yml`
lets developers track
[deployments] to these environments.
The environments page can only be viewed by Reporters and above. For more
information on the permissions, see the
[
permissions documentation
][
permissions
]
.
### Defining environments
While you can create and delete environments manually in the web interface, we
...
...
@@ -129,13 +135,6 @@ stop_review:
action: stop
```
## The relationship between deployments and environments
Deployments are created when [jobs] deploy versions of code to [environments],
so every environment can have one or more deployments. GitLab keeps track of
your deployments, so you always know what is currently being deployed on your
servers.
### View the deployment history
Clicking on an environment will show the history of deployments.
...
...
doc/ci/yaml/README.md
浏览文件 @
8666fd76
...
...
@@ -573,8 +573,7 @@ In its simplest form, the `environment` keyword can be defined like:
deploy to production:
stage: deploy
script: git push production HEAD:master
environment:
name: production
environment: production
```
In the above example, the
`deploy to production`
job will be marked as doing a
...
...
@@ -674,61 +673,6 @@ The `stop_review_app` job is **required** to have the following keywords defined
-
`environment:name`
-
`environment:action`
#### environment:name
#### environment:url
Optional.
#### environment:on_stop
> [Introduced][ce-6669] in GitLab 8.13.
Closing environments can be achieved with the
`on_stop`
keyword defined under
`environment`
. It declares a different job that has to be run in order to close
the environment.
This job is required to have the following keywords defined:
-
`when`
-
[
reference
](
#when
)
-
`environment:name`
-
`environment:action`
- reference below
See below for an example.
#### environment:action
> [Introduced][ce-6669] in GitLab 8.13.
The
`action`
keyword is to be used in conjunction with
`on_stop`
and is defined
in the job that depends on the one that was called from.
Take for instance:
```
yaml
review
:
stage
:
deploy
script
:
make deploy-app
environment
:
name
:
review
on_stop
:
stop_review
stop_review
:
stage
:
deploy
script
:
make delete-app
when
:
manual
environment
:
name
:
review
action
:
stop
```
In the above example we set up the
`review`
job to deploy to the
`review`
environment, and we also defined a new
`stop_review`
job under
`on_stop`
.
Once the
`review`
job is successfully finished, it will trigger the
`stop_review`
job based on what is defined under
`when`
. In this case we set it up to
`manual`
so it will need a
[
manual action
](
#manual-actions
)
via GitLab's web interface
in order to run.
#### dynamic environments
> [Introduced][ce-6323] in GitLab 8.12 and GitLab Runner 1.6.
...
...
@@ -737,9 +681,7 @@ in order to run.
These parameters can use any of the defined
[
CI variables
](
#variables
)
(including predefined, secure variables and
`.gitlab-ci.yml`
variables).
---
**Example configurations**
For example:
```
deploy as review app:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录