From 55b70dad115210d26ebcdd81c09cc0d1da868639 Mon Sep 17 00:00:00 2001 From: Roger Chao Date: Thu, 13 Feb 2025 15:15:01 -0800 Subject: [PATCH] add vscode-web commit id --- vscode-web/main.tf | 7 +++++++ vscode-web/run.sh | 11 +++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/vscode-web/main.tf b/vscode-web/main.tf index 4a2f04e..a2db88e 100644 --- a/vscode-web/main.tf +++ b/vscode-web/main.tf @@ -59,6 +59,12 @@ variable "install_prefix" { default = "/tmp/vscode-web" } +variable "vscode_web_commit_id" { + type = string + description = "Specify the commit ID of the VS Code Web binary to pin to a specific version. If left empty, the latest stable version is used." + default = "" +} + variable "extensions" { type = list(string) description = "A list of extensions to install." @@ -151,6 +157,7 @@ resource "coder_script" "vscode-web" { FOLDER : var.folder, AUTO_INSTALL_EXTENSIONS : var.auto_install_extensions, SERVER_BASE_PATH : local.server_base_path, + VSCODE_WEB_COMMIT_ID : var.vscode_web_commit_id, }) run_on_start = true diff --git a/vscode-web/run.sh b/vscode-web/run.sh index c3423df..0392751 100755 --- a/vscode-web/run.sh +++ b/vscode-web/run.sh @@ -59,8 +59,15 @@ case "$ARCH" in ;; esac -HASH=$(curl -fsSL https://update.code.visualstudio.com/api/commits/stable/server-linux-$ARCH-web | cut -d '"' -f 2) -output=$(curl -fsSL https://vscode.download.prss.microsoft.com/dbazure/download/stable/$HASH/vscode-server-linux-$ARCH-web.tar.gz | tar -xz -C ${INSTALL_PREFIX} --strip-components 1) +# Check if a specific VS Code Web commit ID was provided +if [ -n "${VSCODE_WEB_COMMIT_ID}" ]; then + HASH="${VSCODE_WEB_COMMIT_ID}" +else + HASH=$(curl -fsSL https://update.code.visualstudio.com/api/commits/stable/server-linux-$ARCH-web | cut -d '"' -f 2) +fi +printf "$${BOLD}VS Code Web commit id version $HASH.\n" + +output=$(curl -fsSL "https://vscode.download.prss.microsoft.com/dbazure/download/stable/$HASH/vscode-server-linux-$ARCH-web.tar.gz" | tar -xz -C "${INSTALL_PREFIX}" --strip-components 1) if [ $? -ne 0 ]; then echo "Failed to install Microsoft Visual Studio Code Server: $output"