Telemetry configuration in workspaces errors out
Overview
The workspace_setup script does try to save the GDK config twice, as proven by a unit test. This test was added retroactively to capture the current behaviour rather than to assert such behaviour is actually correct. However, doing that from within the same script only, should not trigger this error message according to my understanding.
The current behaviour leads to the following output after the setup is complete.
✅️ You can access your GDK here: https://3000-workspace-73241-438961-yjtxbk.workspaces.gitlab.dev
ℹ️ Telemetry username has been anonymized.
/projects/gitlab-development-kit/lib/gdk/config_settings.rb:289:in `save_yaml!': Config YAML has been modified since it was loaded. (GDK::ConfigSettings::YamlModified)
from /projects/gitlab-development-kit/lib/gdk/telemetry.rb:227:in `update_settings'
from support/gitlab-remote-development/setup_workspace.rb:98:in `configure_telemetry'
from support/gitlab-remote-development/setup_workspace.rb:26:in `run'
from support/gitlab-remote-development/setup_workspace.rb:126:in `<main>'
* The terminal process "/usr/bin/bash '-c', 'support/gitlab-remote-development/setup_workspace.rb'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
It's still unclear what that means for the telemetry configuration, e.g. if it is already in a good state for workspaces or not. This looks like something that happens within the bootstrap shell script - like a make or rake task does in fact update the GDK config too (or at least it's mtime .
Impacted categories
The following categories relate to this issue:
-
gdk-reliability - e.g. When a GDK action fails to complete. -
gdk-usability - e.g. Improvements or suggestions around how the GDK functions. -
gdk-performance - e.g. When a GDK action is slow or times out.
Steps to replicate (optional)
- Create workspace for GDK on
mainbranch - Let the setup script run through, by opening the workspace.
Proposal (optional)
The underlying issue seems to be that we set GDK configuration before bootstrap as well as after bootstrap and in between we update the gdk.yaml file in another process, such as a make or rake task.
One idea would be to move updating the telemetry config before the actual bootstrap, or at least before this call to save_yaml.
This would leave us with the limitation that we can only ever save the configuration before we start bootstrap, as the bootstrap seems to "modify" the config file.
Another idea would be to see if replacing the mtime-based check with some content-hash on the sorted YAML contents would help. The assumption here is that maybe the bootstrap process does not in fact change anything, but really only sorts the YAML or does something else to the file that has no actual semantics.
As per the discussion below, the shell script should actually be migrated away from.