- Once the review as passed, `topic branch` is merged into `master` where it's deploy to staging.
- Once the review as passed, `topic branch` is merged into `master` where it's deploy to staging.
- After been approved in staging, the changes that were merged into `master` are deployed in to production.
- After been approved in staging, the changes that were merged into `master` are deployed in to production.
### How Review Apps work
## How Review Apps work
A Review App is a mapping of a branch with an [environment](../environments.md).
A Review App is a mapping of a branch with an [environment](../environments.md).
Access to the Review App is made available as a link on the [merge request](../../user/project/merge_requests.md) relevant to the branch.
Access to the Review App is made available as a link on the [merge request](../../user/project/merge_requests.md) relevant to the branch.
...
@@ -41,27 +41,34 @@ In this example, a branch was:
...
@@ -41,27 +41,34 @@ In this example, a branch was:
- Successfully built.
- Successfully built.
- Deployed under a dynamic environment that can be reached by clicking on the **View app** button.
- Deployed under a dynamic environment that can be reached by clicking on the **View app** button.
After adding Review Apps to your workflow, you follow the branched Git flow. That is:
1. Push a branch and let the Runner deploy the Review App based on the `script` definition of the dynamic environment job.
1. Wait for the Runner to build and deploy your web application.
1. Click on the link provided in the merge request related to the branch to see the changes live.
## Configuring Review Apps
## Configuring Review Apps
Review Apps are built on [dynamic environments](../environments.md#configuring-dynamic-environments), which allow you to dynamically create a new environment for each branch.
Review Apps are built on [dynamic environments](../environments.md#configuring-dynamic-environments), which allow you to dynamically create a new environment for each branch.
The process of configuring Review Apps is as follows:
The process of configuring Review Apps is as follows:
1. Set up the infrastructure to host and deploy the Review Apps.
1. Set up the infrastructure to host and deploy the Review Apps (check the [examples](#review-apps-examples) below).
1.[Install](https://docs.gitlab.com/runner/install/) and [configure](https://docs.gitlab.com/runner/commands/) a Runner to do deployment.
1.[Install](https://docs.gitlab.com/runner/install/) and [configure](https://docs.gitlab.com/runner/commands/) a Runner to do deployment.
1. Set up a job in `.gitlab-ci.yml` that uses the [predefined CI environment variable](../variables/README.md)`${CI_COMMIT_REF_NAME}` to create dynamic environments and restrict it to run only on branches.
1. Set up a job in `.gitlab-ci.yml` that uses the [predefined CI environment variable](../variables/README.md)`${CI_COMMIT_REF_NAME}` to create dynamic environments and restrict it to run only on branches.
1. Optionally, set a job that [manually stops](../environments.md#stopping-an-environment) the Review Apps.
1. Optionally, set a job that [manually stops](../environments.md#stopping-an-environment) the Review Apps.
### Examples
## Review Apps examples
The following are example projects that demonstrate Review App configuration:
The following are example projects that demonstrate Review App configuration:
See also the video [Demo: Cloud Native Development with GitLab](https://www.youtube.com/watch?v=jfIyQEwrocw), which includes a Review Apps example.
See also the video [Demo: Cloud Native Development with GitLab](https://www.youtube.com/watch?v=jfIyQEwrocw), which includes a Review Apps example.
### Route Maps
## Route Maps
> Introduced in GitLab 8.17. In GitLab 11.5, the file links are available in the merge request widget.
> Introduced in GitLab 8.17. In GitLab 11.5, the file links are available in the merge request widget.
...
@@ -82,7 +89,7 @@ To set up a route map, add a a file inside the repository at `.gitlab/route-map.
...
@@ -82,7 +89,7 @@ To set up a route map, add a a file inside the repository at `.gitlab/route-map.
which contains a YAML array that maps `source` paths (in the repository) to `public`
which contains a YAML array that maps `source` paths (in the repository) to `public`
paths (on the website).
paths (on the website).
#### Route Maps example
### Route Maps example
The following is an example of a route map for [Middleman](https://middlemanapp.com),
The following is an example of a route map for [Middleman](https://middlemanapp.com),
a static site generator (SSG) used to build [GitLab's website](https://about.gitlab.com),
a static site generator (SSG) used to build [GitLab's website](https://about.gitlab.com),
...
@@ -146,51 +153,102 @@ Once you have the route mapping set up, it will take effect in the following loc
...
@@ -146,51 +153,102 @@ Once you have the route mapping set up, it will take effect in the following loc
!["View on env" button in file view](img/view_on_env_blob.png)
!["View on env" button in file view](img/view_on_env_blob.png)
## Working with Review Apps
## Visual Reviews **(STARTER)**
After adding Review Apps to your workflow, you follow the branched Git flow. That is:
1. Push a branch and let the Runner deploy the Review App based on the `script` definition of the dynamic environment job.
1. Wait for the Runner to build and deploy your web application.
1. Click on the link that provided in the merge request related to the branch to see the changes live.
### Visual Reviews **(STARTER)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/10761) in GitLab Starter 12.0.
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/10761) in GitLab Starter 12.0.
The Visual Reviews feedback form can be added to a Review App to enable reviewers to post comments
With Visual Reviews, you can provide a feedback form to your Review Apps so
directly from the app back to the merge request that spawned the Review App.
that reviewers can post comments directly from the app back to the merge request
that spawned the Review App.
For example, a form like the following can be configured to post the contents of the
### Configuring Visual Reviews
text field into the discussion thread of a merge request:
![feedback form](img/toolbar_feeback_form.png)
The feedback form is served through a script you add to pages in your Review App.
If you have [Developer permissions](../../user/permissions.md) to the project,
you can access it by clicking the **Review** button in the **Pipeline** section
of the merge request.
#### Using Visual Reviews
![review button](img/review_button.png)
If Visual Reviews has been [enabled](#configuring-visual-reviews) for the Review App, the Visual Reviews feedback form is overlaid on the app's pages at the bottom-right corner.
The provided script should be added to the `<head>` of you application and
consists of some project and merge request specific values. Here's what it
Paste the token into the feedback box, when prompted. If you select **Remember me**, your browser stores the token so that future visits to Review Apps at the same URL will not require you to re-enter the token. To clear the token, click **Log out**.
Then, when your app is deployed via GitLab CI/CD, those variables should get
replaced with their real values.
Because tokens must be entered on a per-domain basis and they can only be accessed once, you can save the token to your password manager specifically for the purpose of Visual Reviews. This way, you will not need to create additional tokens for each merge request.