Deploying to a review app for testing
GitLab has a feature called a review app that allows developers to preview their changes directly within a merge request. Review apps use a special kind of environment called dynamic environments, whose names and URLs are set and changed based on the value of CI/CD variables. If you look back at Figure 8.18, you will notice a button that says Enable review app on the top right of the Environments page. Figure 8.19 shows that selecting the button provides a block of code you can paste into your .gitlab-ci.yml
file that creates a job that deploys to a review app environment.
Figure 8.19 – Enable Review App
There are two key items to note in the job content. The first is the use of predefined CI/CD variables to specify the environment name and URL. The name of the review environment will be dynamically updated based on the triggering branch, and the URL will be updated based on the dynamic environment name. This...