Create workspace variables and PAT on workspace creation
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.
- Setup Remote Development
- Create a new workspace by visiting
http://gdk.test:3000/-/remote_development/workspaces/new
- Open Rails console and verify the following
- The config_version of the workspace is
1
. - A personal access token is created for the workspace.
- The PAT created has a
write_repository
scope. - 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.) - Variables are created and associated to the workspace
- The config_version of the workspace is
- 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. - 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.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Vishal Tak