Add reload mechanism to detect script file changes
Issue: Rails development/test environment should pick ... (#520870 - closed)
What does this MR do and why?
This MR registers a file watcher in the development environment to detect changes in workspace scripts under the ee/lib/remote_development/
module. It enables reloading of scripts whenever there is a change to a script or yml file in this directory.
Note: This is only enabled for the development environment because autoreloading is not necessary in the test environment, as it already loads the constants (having script files) with the latest changes when setting up the tests.
References
Similar to hot-reloading for features: Support hot-reloading of feature flags (!40854 - merged)
Screenshots or screen recordings
This MR has no UI changes
Hot reloading - development env |
---|
hot-reload |
How to set up and validate locally
- Setup workspaces locally following this guide
- Checkout this branch and run
gdk restart
so that the file_watcher is registered - Edit any of the script files under
ee/lib/remote_development/workspace_operations
- Example:
ee/lib/remote_development/workspace_operations/create/main_component_updater_start_vscode.sh
- change any of the output statements or log file name - Then go to
http://gdk.test:3000/-/remote_development/workspaces
and create a new workspace - Open the workspace, check the log file for the script at
../workspace-logs/<script-log-file>
. It should have the new changes applied. - (Optional) Change any script file and run a test for that script e.g
ee/spec/lib/remote_development/workspace_operations/create/main_component_updater_start_vscode_script_spec.rb
which tests themain_component_updater_start_vscode.sh
script. The test should already pick up the new changes.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.