One button to enable review apps, auto-edit `.gitlab-ci.yml`, auto-configure GKE
Description
If you didn't start from auto-deploy or otherwise have a .gitlab-ci.yml
, but want to add review apps, we could offer a button to enable review apps, which would then auto-edit .gitlab-ci.yml
and auto-configure GKE to run the apps. This is also useful for users that aren't ready to use Kubernetes for staging and production, probably because they already have some solution and it's not worth migrating, but they're interested in setting up review apps, which is something new to them, so has nothing to migrate from, so why not start with Kubernetes, and there's no easier way to do that then with GKE.
Proposal
- Add button to enable review apps
- Auto-edit
.gitlabi-ci.yml
to addreview
andcleanup
stages with appropriate jobs that leverage auto-deploy capabilities (just for review apps, leaving other CD untouched). - Leverage existing K8s cluster if configured
- Create new k8s cluster if needed
- Configure static IP, Let's Encrypt, and DNS (
*.<group>.gitlab-app.com
or*.<project>.<group>.gitlab-app.com
)
Mockups
Pressing the enable review app button should allow the user to configure review apps as described in https://docs.gitlab.com/ee/ci/review_apps/#configuring-review-apps
Basically the configuration needed makes the user go to 4 different locations, we should allow the user to enter this configuration and we should connect the dots for the user and set all the needed configuration to create the review app
First iteration will be Kubernetes. The button will bring up a page that will ask the user to enter the configuration needed : the dynamic address URL . If the user has K8s cluster setup, we should offer a code snippet that creates the code that needs to be defined in the gitlab-ci.yml file that will spin up the review app.
dynamic environments the address will appear as a variable:
deploy_review:
stage: deploy
script:
- echo "Deploy a review app"
environment:
name: review/$CI_COMMIT_REF_NAME
url: https://$CI_ENVIRONMENT_SLUG.example.com
only:
- branches
except:
- master
https://servocode.com/blog/one-click-app-review-using-kubernetes-and-gitlab-ci/cd
Future phases:
- Next we will add the runner configuration (new issue)
- Add support for ECS/EC2
- Add support for static site
- Last configuration of removal of review apps