diff options
author | Achilleas Pipinellis <axilleas@axilleas.me> | 2016-06-20 14:24:30 +0000 |
---|---|---|
committer | Achilleas Pipinellis <axilleas@axilleas.me> | 2016-06-20 14:24:30 +0000 |
commit | 3c9c1b6c16f21aebfbb897c9611197fc9cf6f870 (patch) | |
tree | fa279eea61133f4d4ae1ef154b45bbea22c910c8 /doc/ci | |
parent | 764c9131d31593cf8508e36db17f6b7bd026f4c0 (diff) | |
parent | 846c659cda838b8df6b41381735627cba76c2a3e (diff) | |
download | gitlab-ce-3c9c1b6c16f21aebfbb897c9611197fc9cf6f870.tar.gz |
Merge branch 'document-environments' into 'master'
Document environments and deployments
## What does this MR do?
Adds an introduction to environments and deployments and tweaks the `environments` entry in `.gitlab-ci.yml` documentation.
## Are there points in the code the reviewer needs to double check?
## Why was this MR needed?
## What are the relevant issue numbers?
Closes #18683.
## Screenshots (if relevant)
![image](/uploads/1e3355c543abaf7b358f3c37596b1f0b/image.png)
![image](/uploads/58a51505674bcf605039db46833a8ae6/image.png)
/cc @ayufan @axil
See merge request !4725
Diffstat (limited to 'doc/ci')
-rw-r--r-- | doc/ci/README.md | 1 | ||||
-rw-r--r-- | doc/ci/environments.md | 58 | ||||
-rw-r--r-- | doc/ci/yaml/README.md | 17 |
3 files changed, 70 insertions, 6 deletions
diff --git a/doc/ci/README.md b/doc/ci/README.md index ef72df97ce6..5a1cb5319c6 100644 --- a/doc/ci/README.md +++ b/doc/ci/README.md @@ -5,6 +5,7 @@ - [Get started with GitLab CI](quick_start/README.md) - [CI examples for various languages](examples/README.md) - [Learn how to enable or disable GitLab CI](enable_or_disable_ci.md) +- [Environments and deployments](environments.md) - [Learn how `.gitlab-ci.yml` works](yaml/README.md) - [Configure a Runner, the application that runs your builds](runners/README.md) - [Use Docker images with GitLab Runner](docker/using_docker_images.md) diff --git a/doc/ci/environments.md b/doc/ci/environments.md new file mode 100644 index 00000000000..040379bb381 --- /dev/null +++ b/doc/ci/environments.md @@ -0,0 +1,58 @@ +# Introduction to environments and deployments + +>**Note:** +Introduced in GitLab 8.9. + +## Environments + +Environments are places where code gets deployed, such as 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. + +## Deployments + +Deployments are created when [jobs] deploy versions of code to [environments]. + +## Defining environments + +You can create and delete environments manually in the web interface, but we +recommend that you define your environments in `.gitlab-ci.yml` first, which +will automatically create environments for you after the first deploy. + +The `environment` is just a hint for GitLab that this job actually deploys to +this environment. Each time the job succeeds, a deployment is recorded, +remembering the git SHA and environment. + +Add something like this to your `.gitlab-ci.yml`: +``` +production: + stage: deploy + script: dpl... + environment: production +``` + +See full [documentation](yaml/README.md#environment). + +## Seeing environment status + +You can find the environment list under **Pipelines > Environments** for your +project. You'll see the git SHA and date of the last deployment to each +environment defined. + +>**Note:** +Only deploys that happen after your `.gitlab-ci.yml` is properly configured will +show up in the environments and deployments lists. + +## Seeing deployment history + +Clicking on an environment will show the history of deployments. + +>**Note:** +Only deploys that happen after your `.gitlab-ci.yml` is properly configured will +show up in the environments and deployments lists. + +[Pipelines]: quick_start/README.md +[jobs]: yaml/README.md#jobs +[environments]: #environments +[deployments]: #deployments diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index 6053bf14536..d0fbcbe9988 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -530,14 +530,18 @@ The above script will: ### environment >**Note:** -Introduced in GitLab v8.9.0. +Introduced in GitLab 8.9. -`environment` is used to define that job does deployment to specific environment. -This allows to easily track all deployments to your environments straight from GitLab. +`environment` is used to define that a job deploys to a specific environment. +This allows easy tracking of all deployments to your environments straight from +GitLab. -If `environment` is specified and no environment under that name does exist a new one will be created automatically. +If `environment` is specified and no environment under that name exists, a new +one will be created automatically. -The `environment` name must contain only letters, digits, '-' and '_'. +The `environment` name must contain only letters, digits, '-' and '_'. Common +names are `qa`, `staging`, and `production`, but you can use whatever name works +with your workflow. --- @@ -550,7 +554,8 @@ deploy to production: environment: production ``` -The `deploy to production` job will be marked as doing deployment to `production` environment. +The `deploy to production` job will be marked as doing deployment to +`production` environment. ### artifacts |