Skip to content

Create workspace variables and PAT on workspace creation

Vishal Tak requested to merge vtak/private_repos_create_update into master

What does this MR do and why?

Issue: Rails: Add support for private repository in cr... (#421507 - closed)

  • Create variables and PAT on workspace creation.
  • These variables and PAT are not injected into the workspace during reconciliation.
  • Revoke the PAT on workspace termination.

Screenshots or screen recordings

Screen_Recording_2023-09-04_at_10.23.36_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
  3. Open Rails console and verify the following
    1. The config_version of the workspace is 1.
    2. A personal access token is created for the workspace.
    3. The PAT created has a write_repository scope.
    4. The PATs expired_at value should co-incide with the workspace's timeout(created_at + max_hours_before_termination of the workspace). Since the PAT's expires_at is a date field, we need to take the ceiling value of the DateTime value and round it off to the next day. (The screen recording attached above was done before this was fixed. So ignore the value in the screen recording.)
    5. Variables are created and associated to the workspace
  4. Open the workspace URL and verify that new variables are NOT injected into the workspace. One such variable to check is GIT_CONFIG_KEY_0 which is created during workspace creation but no yet injected into the workspace.
  5. On workspace termination, the PAT associated with the workspace is revoked.

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

Loading