Skip to content

feat: add extensions gallery to product.json for editor-injector start server script

Vishal Tak requested to merge vtak/enable-marketplace into main

Issue: editor-injector: add extensions gallery to prod... (#20 - closed)

Steps to verify locally

Since this MR is only manipulating the product.json, we can test it without starting the server with some quick changes to verify if the correct values are manipulated.

  • Checkout the branch
  • Apply the following patch
diff --git a/scripts/gl/editor-injector/gl_start_server.sh b/scripts/gl/editor-injector/gl_start_server.sh
index f501dd9abd6..aa5a7ba9a51 100755
--- a/scripts/gl/editor-injector/gl_start_server.sh
+++ b/scripts/gl/editor-injector/gl_start_server.sh
@@ -37,7 +37,7 @@ if [ -z "${GL_EDITOR_EXTENSIONS_GALLERY_RESOURCE_URL_TEMPLATE}" ]; then
 	GL_EDITOR_EXTENSIONS_GALLERY_RESOURCE_URL_TEMPLATE="https://open-vsx.org/api/{publisher}/{name}/{version}/file/{path}"
 fi
 
-PRODUCT_JSON_FILE="${GL_EDITOR_VOLUME_DIR}/code-server/product.json"
+PRODUCT_JSON_FILE="${GL_EDITOR_VOLUME_DIR}/product.json"
 
 if [ "$GL_EDITOR_IGNORE_VERSION_MISMATCH" = true ]; then
 	# TODO: remove this section once issue is fixed - https://gitlab.com/gitlab-org/gitlab/-/issues/373669
@@ -59,8 +59,8 @@ cat "${PRODUCT_JSON_FILE}"
 echo
 
 echo "Starting server for the editor"
-"${GL_EDITOR_VOLUME_DIR}/code-server/bin/gitlab-webide-server" \
-	--host "0.0.0.0" \
-	--port "${GL_EDITOR_PORT}" \
-	--log "${GL_EDITOR_LOG_LEVEL}" \
-	--without-connection-token
+# "${GL_EDITOR_VOLUME_DIR}/code-server/bin/gitlab-webide-server" \
+# 	--host "0.0.0.0" \
+# 	--port "${GL_EDITOR_PORT}" \
+# 	--log "${GL_EDITOR_LOG_LEVEL}" \
+# 	--without-connection-token
  • Run the following command in the root of the repository on your local machine
# udpate GL_EDITOR_VOLUME_DIR to the root of the repository on your local machine
GL_EDITOR_VOLUME_DIR="/Users/vishaltak/dev/gitlab-org/gitlab-web-ide-vscode-fork" GL_EDITOR_ENABLE_MARKETPLACE=true ./scripts/gl/editor-injector/gl_start_server.sh
  • Open product.json and verify the following lines have been added at the top
	"extensionsGallery": {
		"serviceUrl": "https://open-vsx.org/vscode/gallery",
		"itemUrl": "https://open-vsx.org/vscode/item",
		"resourceUrlTemplate": "https://open-vsx.org/api/{publisher}/{name}/{version}/file/{path}"
	},
  • Undo the changes in product.json by running git checkout product.json
  • Run the following command in the root of the repository on your local machine
# udpate GL_EDITOR_VOLUME_DIR to the root of the repository on your local machine
GL_EDITOR_VOLUME_DIR="/Users/vishaltak/dev/gitlab-org/gitlab-web-ide-vscode-fork" GL_EDITOR_ENABLE_MARKETPLACE=true GL_EDITOR_EXTENSIONS_GALLERY_SERVICE_URL=testserviceurl GL_EDITOR_EXTENSIONS_GALLERY_ITEM_URL=testitemurl GL_EDITOR_EXTENSIONS_GALLERY_RESOURCE_URL_TEMPLATE=testresourceurltemplate ./scripts/gl/editor-injector/gl_start_server.sh
  • Open product.json and verify the following lines have been added at the top
	"extensionsGallery": {
		"serviceUrl": "testserviceurl",
		"itemUrl": "testitemurl",
		"resourceUrlTemplate": "testresourceurltemplate"
	},
  • Undo the changes in product.json by running git checkout product.json
Edited by Vishal Tak

Merge request reports