Expose workspace_variables in graphQL API
MR: Add new query API to expose workspace variables... (!176617 - merged)
Description
We have a workspaces_variables table in the database which stores variables that get injected into the workspace at the time of creation.
Variables that get injected into a workspace are either static_variables such as:
-
GL_EDITOR_EXTENSIONS_GALLERY_SERVICE_URL -
GL_EDITOR_EXTENSIONS_GALLERY_ITEM_URL -
... See ee/lib/remote_development/workspace_operations/create/workspace_variables.rb for complete list
OR
user_provided_variables which can be added by the user with the Add variable option while creating a new workspace.
With this issue we want to introduce the workspaces_variables in the graphQL API to setup a foundation for future work including:
- Third-party integrations or user automations/scripting/reporting
- Facilitating QA/E2E testing
- Making variables available in the UI
This includes creating a new Type/Resolver/Finder so that the workspaces_variables data can be queried via graphQL.
There are the DB fields available
id, workspace_id, variable_type, created_at, updated_at, key, encrypted_value, encrypted_value_iv, project_id
Technical Requirements
GraphQL Changes
-
Type.workspaceVariablename type field idGlobalIDType[::RemoteDevelopment::WorkspaceVariable]field variableTypeWorkspaceVariableTypefield keyStringfield valueStringfield createdAtTimeTypefield updatedAtTimeType -
Type.workspacename type field workspaceVariables[WorkspaceVariable!]
- Only return
user_providedvariables through the API - Ask graphQL team about policy around deprecating a type. If its possible then deprecate
WorkspaceVariableInputTypeand replace withWorkspaceVariableTypewhich can be used in both theWorkspaceVariableInputand the newWorkspaceVariable - Introduce the new graphQL changes marked as
alpha
Acceptance Criteria
-
Add new type WorkspaceVariable -
Add new field workspace_variablestoWorkspaceType -
Add new Finder/Resolver for workspace_variables -
Mark new graphQL changes (fields/arguments) as alpha -
Add migration to introduce new boolean field user_providedin theworkspace_variablestable & backfill -
Delegate policy to workspaces authorization rules -
Add new WorkspaceVariableTypeto replaceWorkspaceVariableInput -
Deprecate WorkspaceVariableInputif possible -
Add unit tests for the Finder -
Add relevant request specs to the ee/spec/requests/api/graphql/remote_development/workspacefolder -
Update tests.ymlandscripts/verify-tff-mapping