Create conditional "Enable Review App" button
Problem to solve
As part of &2349 we want to make configuring review apps easier for the user.
Intended users
Further details
Proposal
A button named "Enable review app" should be created. It should be located on the environment page.
Conditions for this button to appear:
- No review app exists.
- Project does not use AutoDevOps
- The project is "reviewable". I created a Rails sample project and a Pages project. With AutoDevOps turned on and a Kubernetes cluster linked to each project, there's no review stage for the Pages one, while there is one for the Rails project.
Pressing the button should open a modal that tells the user to copy this snippet to the gitlab-ci.yml file
deploy_review:
stage: deploy
script:
- echo "Deploy a review app"
environment:
name: review/$CI_COMMIT_REF_NAME
url: http://$CI_ENVIRONMENT_SLUG.$KUBE_INGRESS_BASE_DOMAIN
only:
- branches
except:
- master
Together with instructions to the user
UX Proposal
If the above conditions are met display an Enable Review App
button on the environments page.
On clicking the button, open a modal as shown
Links shown in the steps:
- Step 1 - 'configured' should link to the cluster page (-/clusters) https://docs.gitlab.com/ee/user/project/clusters/add_remove_clusters.html
- Step 3 - 'gitlab-ci.yml' should link to the project yaml file (blob/master/.gitlab-ci.yml)
Note: A similar look and feel for modal can be seen by clicking the Review button in MRs that do not have visual review enabled.