diff --git a/.devfile.yaml b/.devfile.yaml index 43c5d753cfc53ea5f03809a498171daabfd73d50..f13a6b3e37a8f37e66364a629a52b5036eb7abfc 100644 --- a/.devfile.yaml +++ b/.devfile.yaml @@ -4,7 +4,7 @@ components: attributes: gl/inject-editor: true container: - image: registry.gitlab.com/gitlab-org/remote-development/gitlab-remote-development-docs/debian-bullseye-ruby-3.2.patched-golang-1.20-rust-1.65-node-18.16-postgresql-15@sha256:216b9bf0555349f4225cd16ea37d7a627f2dad24b7e85aa68f4d364319832754 + image: registry.gitlab.com/gitlab-org/gitlab-build-images:workspaces-web-ide env: - name: STORYBOOK_HOST value: "0.0.0.0" diff --git a/.vscode/tasks.json b/.vscode/tasks.json index dffab3daac4963f0d6fb3de0a88ee22ac88f8502..18fbcdfa27c560da12ba7c5dbf2630cda2d96b39 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -2,13 +2,18 @@ "version": "2.0.0", "tasks": [ { - "label": "Build and run storybook", - "type": "shell", - "command": "yarn install && yarn storybook", - "presentation": { - "echo": true, - "reveal": "always" - } - } + "type": "shell", + "command": "${workspaceFolder}/bin/initialize-workspaces.sh", + "isBackground": false, + "group": "none", + "problemMatcher": [], + "label": "GitLab Workspaces: Set up workspace", + "runOptions": { + "runOn": "folderOpen" + }, + "presentation": { + "close": true + } + } ] -} \ No newline at end of file +} diff --git a/bin/initialize-workspaces.sh b/bin/initialize-workspaces.sh new file mode 100755 index 0000000000000000000000000000000000000000..c428a52ac51d0fd75234fbca28a0e6a2831d5d2b --- /dev/null +++ b/bin/initialize-workspaces.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# See https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html +set -e # Abort script at first error, when a command exits with non-zero status (except in until or while loops, if-tests, list constructs) +set -u # Attempt to use undefined variable outputs error message, and forces an exit +set -o pipefail # Causes a pipeline to return the exit status of the last command in the pipe that returned a non-zero return value. + +if [[ -z "${GL_TOOLS_DIR:-}" ]]; then + echo "This environment is not a GitLab Workspace. Skipping setup step..." + exit 0 +else + echo "Detected GitLab Workspaces environment. Running additional setup step..." +fi + +# Install dependencies managed by asdf +asdf install + +# Install dependencies managed by yarn +yarn install diff --git a/doc/contributing/workspaces.md b/doc/contributing/workspaces.md new file mode 100644 index 0000000000000000000000000000000000000000..e587ce2c307d5e384879c293b4c31d379a5740a3 --- /dev/null +++ b/doc/contributing/workspaces.md @@ -0,0 +1,14 @@ +# Using workspaces to develop the GitLab UI + +GitLab team members can use [GitLab Workspaces](https://docs.gitlab.com/ee/user/workspace/) +to develop the GitLab UI. Follow these instructions to create a new Workspace: + +1. Open the [GitLab UI's project page](https://gitlab.com/gitlab-org/gitlab-ui). +1. In the Git revision dropdown, select the branch you want to work on. +1. Select the "Edit" button. In the dropdown, select the "New workspace" button. +1. You'll be redirected to the "New Workspace" form. +1. Select the "Create Workspace" button. +1. Once the Workspace has been created, you can open it in VSCode for the Web. +1. Once you are in the Workspace for the first time, a VSCode task will install `asdf` dependencies + and `npm` dependencies. It will take a few minutes to complete. +1. Start developing on Workspaces!