Skip to content

Rename variables to workspace_variables in create mutation

Issue: Rename variables to workspace_variables in crea... (#526956 - closed)

What does this MR do and why?

Replaces the variables arg for the graphql workspaceCreate mutation with workspace_variables

  • Deprecate the old variables arg
  • Add new worskpace_variables arg (marked as experiment)
  • Update graphql docs

The decision for this change is based on the discussion here: !184854 (comment 2401850882)

Changelog: changed EE: true

References

Screenshots or screen recordings

This MR contains no UI changes

GraphQL mutation (workspace_variables arg) GraphQL mutation (variables arg)
Screenshot_2025-04-23_at_5.04.51_PM Screenshot_2025-04-23_at_5.19.33_PM
Workspace (workspace_variables arg) GraphQL query for workspace variables
Screenshot_2025-04-23_at_5.05.57_PM Screenshot_2025-04-23_at_5.20.03_PM
GraphQL docs
Screenshot_2025-04-23_at_5.08.24_PM

How to set up and validate locally

  • Setup workspaces locally following this guide
  • Run bundle exec scripts/remote_development/run-smoke-test-suite.sh, all (non-flaky) tests should still pass
  • Go to the GraphQL Explorer, http://gdk.test:3000/-/graphql-explorer, and run the following query
mutation {
  workspaceCreate(input: {
    projectId: "gid://gitlab/Project/{replace-with-project-id}",
    clusterAgentId: "gid://gitlab/Clusters::Agent/{replace-with-agent-id}",
    desiredState: "Running",
    devfilePath: ".devfile.yaml",
    devfileRef: "main",
    variables: [],
    workspaceVariables: [
    { 
       key: "ENV_KEY", 
       value: "ENV_VAL", 
       variableType: "ENVIRONMENT"
     }]
  }) {
    workspace {
      id
      name
      namespace
      __typename
    }
    errors
    __typename
  }
}
  • Then go to http://gdk.test:3000/-/remote_development/workspaces and open the new workspace
  • Check that the workspace variables are present in the workspace as ENV variables in the terminal env | grep -i "ENV_KEY"

MR acceptance checklist

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

Edited by Daniyal Arshad

Merge request reports

Loading