Skip to content

Move Google Cloud instructions to reduce duplication

What does this MR do and why?

This change moves the specific Google Cloud instructions so they are part of the more general runner registration instructions component.

It has little impact in the UX, as the message for a successful runner registration is made consistent in both the registration flows.

Changelog: changed

Technical Notes

Currently we use two variants of the registration instructions: registration_instructions.vue and google_cloud_registration_instructions.vue which duplicate a significant amount of code.

With this improvement registration_instructions.vue becomes the parent of google_cloud_registration_instructions.vue. registration_instructions.vue now fetches runner, such as the runner token and renders the platforms_drawer.vue, simplifying the upper level components.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

The registration success messages are the same in both methods:

Current New
regular-old regular-new
gc-old gc-new

How to set up and validate locally

Create a couple of runners:

  1. Simulate a SaaS instance in your GDK
  2. Enable the feature flag
 echo "Feature.enable(:google_cloud_support_feature_flag)" | rails c
  1. Visit project runner creation Project -> Settings -> CI/CD -> Runners -> New project Runner

Validate Google Cloud registration

  1. Select google cloud radio option (for platform)
  2. Create a runner

Validate other registration

  1. Select linux radio option (for platform)
  2. Create a runner and follow the command line instructions.

Note: You can simulate a new runner registration by changing a line of code:

diff --git a/app/assets/javascripts/ci/runner/components/registration/registration_instructions.vue b/app/assets/javascripts/ci/runner/components/registration/registration_instructions.vue
index 81086a829c08..02eb96cbe6cb 100644
--- a/app/assets/javascripts/ci/runner/components/registration/registration_instructions.vue
+++ b/app/assets/javascripts/ci/runner/components/registration/registration_instructions.vue
@@ -136,6 +136,7 @@ export default {
       return runCommand({ platform: this.platform });
     },
     isRunnerOnline() {
+      return true;
       return this.runner?.status === STATUS_ONLINE;
     },
     showGoogleCloudRegistration() {

Related to #431390 (closed)

Edited by Miguel Rincon

Merge request reports

Loading