File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
registry/coder/modules/vscode-web Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,16 @@ variable "subdomain" {
136136 default = true
137137}
138138
139+ variable "platform" {
140+ type = string
141+ description = " The platform to use for the VS Code Web."
142+ default = " "
143+ validation {
144+ condition = var. platform == " " || var. platform == " linux" || var. platform == " darwin" || var. platform == " alpine" || var. platform == " win32"
145+ error_message = " Incorrect value. Please set either 'linux', 'darwin', or 'alpine' or 'win32'."
146+ }
147+ }
148+
139149data "coder_workspace_owner" "me" {}
140150data "coder_workspace" "me" {}
141151
@@ -158,6 +168,7 @@ resource "coder_script" "vscode-web" {
158168 AUTO_INSTALL_EXTENSIONS : var.auto_install_extensions,
159169 SERVER_BASE_PATH : local.server_base_path,
160170 COMMIT_ID : var.commit_id,
171+ PLATFORM : var.platform,
161172 })
162173 run_on_start = true
163174
Original file line number Diff line number Diff line change @@ -59,15 +59,26 @@ case "$ARCH" in
5959 ;;
6060esac
6161
62+ # Detect the platform
63+ if [ -n " ${PLATFORM} " ]; then
64+ DETECTED_PLATFORM=" ${PLATFORM} "
65+ elif [ -f /etc/alpine-release ] || grep -qi ' ID=alpine' /etc/os-release 2> /dev/null || command -v apk > /dev/null 2>&1 ; then
66+ DETECTED_PLATFORM=" alpine"
67+ elif [ " $( uname -s) " = " Darwin" ]; then
68+ DETECTED_PLATFORM=" darwin"
69+ else
70+ DETECTED_PLATFORM=" linux"
71+ fi
72+
6273# Check if a specific VS Code Web commit ID was provided
6374if [ -n " ${COMMIT_ID} " ]; then
6475 HASH=" ${COMMIT_ID} "
6576else
66- HASH=$( curl -fsSL https://update.code.visualstudio.com/api/commits/stable/server-linux -$ARCH -web | cut -d ' "' -f 2)
77+ HASH=$( curl -fsSL https://update.code.visualstudio.com/api/commits/stable/server-$DETECTED_PLATFORM -$ARCH -web | cut -d ' "' -f 2)
6778fi
6879printf " $$ {BOLD}VS Code Web commit id version $HASH .\n"
6980
70- 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)
81+ output=$( curl -fsSL " https://vscode.download.prss.microsoft.com/dbazure/download/stable/$HASH /vscode-server-$DETECTED_PLATFORM -$ARCH -web.tar.gz" | tar -xz -C " ${INSTALL_PREFIX} " --strip-components 1)
7182
7283if [ $? -ne 0 ]; then
7384 echo " Failed to install Microsoft Visual Studio Code Server: $output "
You can’t perform that action at this time.
0 commit comments