Skip to content

Add support creating and reconciling workspaces version 2

Vishal Tak requested to merge vtak/private_repos_reconcile into master

What does this MR do and why?

Issue: Rails: Add support for private repository in re... (#419617 - closed)

This MR is a followup and building on top of Create workspace variables and PAT on workspace... (!129708 - merged)

  • Add support creating and reconciling 2.0.0 version workspaces.
  • All workspaces created before this MR is merged will have config_version=1 and would continue to work as it is without any disruption.
  • All workspaces created after this MR is merged will have config_version=2 and would have the secrets(e.g. PAT) injected into the workspace.
    • Thus, we can directly commit from the CLI/UI inside the workspace.

To felicitate this, the following changes have been made -

  • Existing code of devfile_parser/devfile_parser_spec and been moved to devfile_parser_prev1/devfile_parser_prev1_spec. This is required for all workspaces with config_version=1.
  • The new code in devfile_parser/devfile_parser_spec is for workspaces with config_version=2.
  • Existing code of desired_config_generator/desired_config_generator_spec and been moved to desired_config_generator_prev1/desired_config_generator_prev1_spec. It now calls devfile_parser_prev1. This is required for all workspaces with config_version=1.
  • The new code in desired_config_generator is for workspaces with config_version=2.

More details about this naming the refactoring are described in #421898 (comment 1517123723) .

After a week, there will no longer be any workspaces with config_version=1 on SaaS due to workspace timeout. Support for the old config_version for self-managed will be removed in Rails: Migrate workspaces with config_version=1... (#424215 - closed).

Screenshots or screen recordings

Screen_Recording_2023-09-04_at_11.39.09_AM

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Setup Remote Development
  2. Create a new workspace by visiting http://gdk.test:3000/-/remote_development/workspaces/new before checking out this branch. This will be used to verify that existing workspaces are reconciled as they were and there is no change in them. In the Rails console, verify that RemoteDevelopment::Workspace.last.config_version is 1.
  3. Checkout this branch and create a new workspace by visiting http://gdk.test:3000/-/remote_development/workspaces/new. In the Rails console, verify that RemoteDevelopment::Workspace.last.config_version is 2.
  4. Open the new workspace URL and verify that new variables are injected into the workspace. One such variable is GIT_CONFIG_KEY_.
  5. Make changes to some file, commit and push it. The PAT injected should be used transparently.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Vishal Tak

Merge request reports