Address polling edge cases in runner registration
What does this MR do and why?
This change addresses two cases which may happen during the display of the runner registration page.
- After the token is no longer available (1 hour) the runner token disappears from the screen, leaving the user unable to copy the token.
- If the runner is deleted (in another screen) the page stops updating the runner information.
While currently the 1 hour time seems long, it may be shortened to a few minutes as the feature is refined, so these cases may become more common.
Screenshots or screen recordings
To test this, I simulated the runner registration availability running out by replacing the code, after the 30 seconds without registering, the runner page is preserved:
before | after |
---|---|
How to set up and validate locally
- Enable the feature flag: in your console
rails c
, and thenFeature.enable(:create_runner_workflow_for_admin)
Edge case 1: The token is no longer available
- Change the current REGISTRATION_AVAILABILITY_TIME to a very short duration, like 30 seconds
diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb
index eacb3ab8cd6e..3bb69cbae060 100644
--- a/app/models/ci/runner.rb
+++ b/app/models/ci/runner.rb
@@ -58,7 +58,7 @@ class Runner < Ci::ApplicationRecord
STALE_TIMEOUT = 3.months
# Only allow authentication token to be visible for a short while
- REGISTRATION_AVAILABILITY_TIME = 1.hour
+ REGISTRATION_AVAILABILITY_TIME = 30.seconds
AVAILABLE_TYPES_LEGACY = %w[specific shared].freeze
AVAILABLE_TYPES = runner_types.keys.freeze
- Enable the feature flag: in your console
rails c
, and thenFeature.enable(:create_runner_workflow_for_admin)
- Follow the runner creation instructions from http://gdk.test:3000/admin/runners
- Wait 30 seconds at the registration page e.g. http://gdk.test:3000/admin/runners/398/register?platform=linux
- The registration page should not change
Edge case 2: The runner is deleted
- Follow the runner creation instructions from http://gdk.test:3000/admin/runners
- Open a new tab, and delete the runner
- In the original tab, the registration page should not change
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #383139 (closed)
Edited by Miguel Rincon