Skip to content

Saf add termination validations and limits to workspaces

Issue: Backend and Database: integrate agent max_hours... (#472548 - closed)

What does this MR do and why?

This MR includes functionality to specify workspace termination limits within the bounds of the associated agent at the time of creation. It also includes:

  • Data migrations to cap existing workspace models at the new limit.

See the attached issue for more in-depth context.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots

Screenshot_2024-08-27_at_11.55.19_AM

Error on workspace creation termination value beyond the agent's limit

How to set up and validate locally

I believe validating the data migration is covered by the migration test.

To test the new validation:

  1. Setup GDK with remote development locally
  2. update the agent config termination limits to any reasonable values such as :
remote_development:
  ........
  default_max_hours_before_termination: 44
  max_hours_before_termination_limit: 540
  1. Attempt to create a workspace with the agent configured above, but set the "Workspace automatically terminates after" field to > 540 or greater than whatever value you used above. Expectation: Workspace creation failure with a message about exceeding the limit.
  2. Create the workspace with a valid termination duration Expectation: Workspace creation success and is accessible.
  3. Update the agent config max_hours_before_termination_limit to another value less than the one set above.
  4. Attempt to create a workspace with a value greater than the limit set in step 5 Expectation: Workspace creation failure with a message about exceeding the limit.
  5. Stop the workspace created in step 4 and restart the workspace (This will force its state to be re-persisted to the DB).Expectation: Workspace runs and is still accessible.
Edited by Safwan Ahmed

Merge request reports

Loading