Add environment documentation

This commit is contained in:
Stepan Strelets 2017-03-26 00:59:39 +03:00 committed by Dmitry Khomutov
parent 047cedaab3
commit 8c1a26697a
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9
2 changed files with 48 additions and 0 deletions

View file

@ -23,6 +23,7 @@ Using PHP Censor
* [Git](sources/git.md)
* [Injecting variables into messages](interpolation.md)
* [Project Status Images and Status Page](status.md)
* [Build environments](environments.md)
Plugins
-------

47
docs/en/environments.md Normal file
View file

@ -0,0 +1,47 @@
Environments
============
A environment can include several branches - base branch (default project branch) and optional additional branches (which merge into base).
When you commit to a branch, builds all environments in which branch included (base branch implicitly included to all environments).
When you build a environment, additional branches merged into base branch.
For example, it can be useful when yoy dealy merging into master or test some branches at once. Or deploy.
Config example and explanation
------------------------------
Configuration is specified on project edit page.
In this example, there are three environments:
* Production (named `pr`) is associated with the default branch for the project.
* Release candidate (`rc`) - branch by default plus branch `feature-A`
* Test (`test`) - branch by default plus branch `feature-B`
```yml
pr:
rc:
- feature-A
test:
- feature-B
```
When you push commits to `master` branch, three builds will be created - one for each of the environments.
If push commit to branch `feature-A` - build for `rc` environment will be created.
If push commit to branch `feature-C` - no build will be created.
You can use variable `%ENVIRONMENT%` in project config.
```yml
setup:
mysql:
- "DROP DATABASE IF EXISTS project_name_%ENVIRONMENT%;"
- "CREATE DATABASE project_name_%ENVIRONMENT%;"
test:
...
deploy:
mage:
env: %ENVIRONMENT%
```