diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index 18783d30c58699c2df8a57310d1c4195ff8837fd..899f0ea2f2f1ed1d9e3e962e3e8e90cdbb163be8 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -30449,23 +30449,24 @@ Represents a remote development workspace. | Name | Type | Description | | ---- | ---- | ----------- | | `actualState` | [`String!`](#string) | Actual state of the workspace. | -| `clusterAgent` | [`ClusterAgent!`](#clusteragent) | Kubernetes Agent associated with the workspace. | -| `createdAt` | [`Time!`](#time) | Timestamp of workspace creation. | -| `deploymentResourceVersion` | [`Int`](#int) | ResourceVersion of the Deployment resource for the workspace. | +| `clusterAgent` | [`ClusterAgent!`](#clusteragent) | Kubernetes agent associated with the workspace. | +| `createdAt` | [`Time!`](#time) | Timestamp of when the workspace was created. | +| `deploymentResourceVersion` | [`Int`](#int) | Version of the deployment resource for the workspace. | | `desiredState` | [`String!`](#string) | Desired state of the workspace. | -| `desiredStateUpdatedAt` | [`Time!`](#time) | Timestamp of last update to desired state. | +| `desiredStateUpdatedAt` | [`Time!`](#time) | Timestamp of the last update to the desired state. | | `devfile` | [`String!`](#string) | Source YAML of the devfile used to configure the workspace. | -| `devfilePath` | [`String!`](#string) | Project repo git path containing the devfile used to configure the workspace. | -| `devfileRef` | [`String!`](#string) | Project repo git ref containing the devfile used to configure the workspace. | +| `devfilePath` | [`String!`](#string) | Path to the devfile used to configure the workspace. | +| `devfileRef` | [`String!`](#string) | Git reference that contains the devfile used to configure the workspace. | +| `devfileWebUrl` | [`String!`](#string) | Web URL of the devfile used to configure the workspace. | | `editor` | [`String!`](#string) | Editor used to configure the workspace. Must match a configured template. | | `id` | [`RemoteDevelopmentWorkspaceID!`](#remotedevelopmentworkspaceid) | Global ID of the workspace. | -| `maxHoursBeforeTermination` | [`Int!`](#int) | Maximum hours the workspace can exist before it is automatically terminated. | +| `maxHoursBeforeTermination` | [`Int!`](#int) | Number of hours until the workspace automatically terminates. | | `name` | [`String!`](#string) | Name of the workspace in Kubernetes. | | `namespace` | [`String!`](#string) | Namespace of the workspace in Kubernetes. | | `processedDevfile` | [`String!`](#string) | Processed YAML of the devfile used to configure the workspace. | -| `projectId` | [`ID!`](#id) | ID of the Project providing the Devfile for the workspace. | -| `respondedToAgentAt` | [`Time`](#time) | Timestamp of last response sent to GA4K for the workspace. | -| `updatedAt` | [`Time!`](#time) | Timestamp of last update to any mutable workspace property. | +| `projectId` | [`ID!`](#id) | ID of the project that contains the devfile for the workspace. | +| `respondedToAgentAt` | [`Time`](#time) | Timestamp of the last response sent to the GitLab agent for Kubernetes for the workspace. | +| `updatedAt` | [`Time!`](#time) | Timestamp of the last update to any mutable workspace property. | | `url` | [`String!`](#string) | URL of the workspace. | | `user` | [`UserCore!`](#usercore) | Owner of the workspace. | diff --git a/doc/user/workspace/configuration.md b/doc/user/workspace/configuration.md index 8ac22a1177390cd4f18a1189deff62bbfa314115..646002a5b52a0863c84c1b44b2da95020e3bcc97 100644 --- a/doc/user/workspace/configuration.md +++ b/doc/user/workspace/configuration.md @@ -46,15 +46,22 @@ which you can customize to meet the specific needs of each project. ### Create a workspace +> - **Git reference** and **Devfile location** [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/392382) in GitLab 16.10. +> - **Time before automatic termination** [renamed](https://gitlab.com/gitlab-org/gitlab/-/issues/392382) to **Workspace automatically terminates after** in GitLab 16.10. + To create a workspace: 1. On the left sidebar, select **Search or go to**. 1. Select **Your work**. 1. Select **Workspaces**. 1. Select **New workspace**. -1. From the **Select project** dropdown list, [select a project with a `.devfile.yaml` file](#prerequisites). -1. From the **Select cluster agent** dropdown list, select a cluster agent owned by the group the project belongs to. -1. In **Time before automatic termination**, enter the number of hours until the workspace automatically terminates. +1. From the **Project** dropdown list, [select a project with a `.devfile.yaml` file](#prerequisites). +1. From the **Cluster agent** dropdown list, select a cluster agent owned by the group the project belongs to. +1. From the **Git reference** dropdown list, select the branch, tag, or commit hash + GitLab uses to create the workspace. +1. In **Devfile location**, enter the path to the devfile you use to configure the workspace. + If your devfile is not in the root directory of your project, specify a relative path. +1. In **Workspace automatically terminates after**, enter the number of hours until the workspace automatically terminates. This timeout is a safety measure to prevent a workspace from consuming excessive resources or running indefinitely. 1. Select **Create workspace**. diff --git a/ee/app/assets/javascripts/remote_development/components/agent_admin_ui/agent_workspaces_list.vue b/ee/app/assets/javascripts/remote_development/components/agent_admin_ui/agent_workspaces_list.vue index 4d272408b7bc365624cafd2fd70576ae951bd260..9195cea13e4dd2da567494ef59f4027a26209f3a 100644 --- a/ee/app/assets/javascripts/remote_development/components/agent_admin_ui/agent_workspaces_list.vue +++ b/ee/app/assets/javascripts/remote_development/components/agent_admin_ui/agent_workspaces_list.vue @@ -7,7 +7,7 @@ import { WORKSPACES_LIST_POLL_INTERVAL, } from '../../constants'; import agentWorkspacesListQuery from '../../graphql/queries/agent_workspaces_list.query.graphql'; -import { fetchProjectNames, populateWorkspacesWithProjectNames } from '../../services/utils'; +import { fetchProjectsDetails, populateWorkspacesWithProjectDetails } from '../../services/utils'; import WorkspacesList from '../common/workspaces_list.vue'; export const i18n = { @@ -51,7 +51,7 @@ export default { return; } const workspaces = data?.project?.clusterAgent?.workspaces?.nodes; - const result = await fetchProjectNames(this.$apollo, workspaces); + const result = await fetchProjectsDetails(this.$apollo, workspaces); if (result.error) { this.error = i18n.loadingWorkspacesFailed; @@ -60,7 +60,7 @@ export default { return; } - this.workspaces = populateWorkspacesWithProjectNames(workspaces, result.projects); + this.workspaces = populateWorkspacesWithProjectDetails(workspaces, result.projects); this.pageInfo = data?.project?.clusterAgent?.workspaces?.pageInfo; }, }, diff --git a/ee/app/assets/javascripts/remote_development/components/common/get_project_details_query.vue b/ee/app/assets/javascripts/remote_development/components/common/get_project_details_query.vue index 86177d7f1c85eedf74bd6cc5cddff3fe45d6cc66..50510fe36d0561f3f4785e0a5509d337db4deb6b 100644 --- a/ee/app/assets/javascripts/remote_development/components/common/get_project_details_query.vue +++ b/ee/app/assets/javascripts/remote_development/components/common/get_project_details_query.vue @@ -3,7 +3,6 @@ import { uniqBy } from 'lodash'; import { logError } from '~/lib/logger'; import getProjectDetailsQuery from '../../graphql/queries/get_project_details.query.graphql'; import getGroupClusterAgentsQuery from '../../graphql/queries/get_group_cluster_agents.query.graphql'; -import { DEFAULT_DEVFILE_PATH } from '../../constants'; export default { props: { @@ -19,7 +18,6 @@ export default { variables() { return { projectFullPath: this.projectFullPath, - devFilePath: DEFAULT_DEVFILE_PATH, }; }, skip() { @@ -39,9 +37,6 @@ export default { const { nameWithNamespace, repository, group, id } = result.data.project; - const hasDevFile = repository - ? repository.blobs.nodes.some(({ path }) => path === DEFAULT_DEVFILE_PATH) - : false; const rootRef = repository ? repository.rootRef : null; if (!group) { @@ -51,7 +46,6 @@ export default { fullPath: this.projectFullPath, nameWithNamespace, clusterAgents: [], - hasDevFile, rootRef, }); return; @@ -81,7 +75,6 @@ export default { fullPath: this.projectFullPath, nameWithNamespace, clusterAgents: uniqClusterAgents, - hasDevFile, rootRef, }); }, @@ -97,6 +90,10 @@ export default { }); if (error) { + // NOTE: It seems to be impossible to have test coverage for this line + // with the current version of mock-apollo-client. Any type of + // mock error is always thrown and caught below instead of + // being returned. return { error }; } diff --git a/ee/app/assets/javascripts/remote_development/components/common/workspaces_list.vue b/ee/app/assets/javascripts/remote_development/components/common/workspaces_list.vue index 7ededb9ea5013f7339f88667445c331afe6ba02a..9351cc47fd99aba76b5a904c675898e7400e8b18 100644 --- a/ee/app/assets/javascripts/remote_development/components/common/workspaces_list.vue +++ b/ee/app/assets/javascripts/remote_development/components/common/workspaces_list.vue @@ -78,7 +78,7 @@ export default { > {{ $options.i18n.learnMoreHelpLink }} diff --git a/ee/app/assets/javascripts/remote_development/components/list/workspaces_table.vue b/ee/app/assets/javascripts/remote_development/components/list/workspaces_table.vue index 30adacfd7f6a1ebb8dc2e752c928892e0139ecbb..a3c76ac9fc4aa3f6584971bb8dc141524db1a034 100644 --- a/ee/app/assets/javascripts/remote_development/components/list/workspaces_table.vue +++ b/ee/app/assets/javascripts/remote_development/components/list/workspaces_table.vue @@ -1,6 +1,6 @@