One button to enable review apps, auto-edit `.gitlab-ci.yml`, auto-configure GKE
<!-- triage-serverless v3 PLEASE DO NOT REMOVE THIS SECTION --> *This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.* <!-- triage-serverless v3 PLEASE DO NOT REMOVE THIS SECTION --> ### 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 add `review` and `cleanup` 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 ![pipelines-environments__review-apps--enable](/uploads/50d4a99df54e04c1663ca0a5650824d8/pipelines-environments__review-apps--enable.png) ![pipelines-environments__review-apps--success](/uploads/630f5c705e63bcb49550438a6580423e/pipelines-environments__review-apps--success.png) 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 ### Links / references * https://gitlab.com/gitlab-org/gitlab-ce/issues/27888
epic