|
| 1 | +#!/usr/bin/env bash |
| 2 | +set -euo pipefail |
| 3 | + |
| 4 | +# openvscode-server is Gitpod's build of VS Code's *upstream* web server, offered |
| 5 | +# as an alternative backend to code-server (Coder's fork) for jupyter-vscode-proxy. |
| 6 | +# The proxy chooses the backend from $CODE_EXECUTABLE and launches whichever of |
| 7 | +# `code-server` / `openvscode-server` is named; both accept --port/--socket and |
| 8 | +# --extensions-dir, so the "VS Code" launcher tile is otherwise unchanged. |
| 9 | +# |
| 10 | +# Why we test it: terminal, file explorer, and the Claude extension all hang off |
| 11 | +# code-server's WebSocket + reconnection layer, which is one of the most heavily |
| 12 | +# *patched* parts of Coder's fork. Under iOS/iPadOS WebKit (which every iOS |
| 13 | +# browser is forced to use) that layer fails — the shell renders but nothing |
| 14 | +# interactive connects. openvscode-server stays close to the upstream VS Code-web |
| 15 | +# code Microsoft actually exercises on Safari for vscode.dev, so swapping it in |
| 16 | +# isolates that single variable. |
| 17 | + |
| 18 | +# Pin with OPENVSCODE_VERSION (e.g. 1.109.5); the default resolves the latest |
| 19 | +# release tag so the test image tracks upstream without a hardcoded version. |
| 20 | +VERSION="${OPENVSCODE_VERSION:-latest}" |
| 21 | +if [ "${VERSION}" = "latest" ]; then |
| 22 | + TAG="$(curl -fsSL https://api.github.com/repos/gitpod-io/openvscode-server/releases/latest \ |
| 23 | + | grep '"tag_name"' | head -1 \ |
| 24 | + | sed -E 's/.*"openvscode-server-v([^"]+)".*/\1/')" |
| 25 | +else |
| 26 | + TAG="${VERSION}" |
| 27 | +fi |
| 28 | +[ -n "${TAG}" ] || { echo "ERROR: could not resolve openvscode-server version" >&2; exit 1; } |
| 29 | + |
| 30 | +# Map Docker's arch to the release asset suffix. The CI workflow builds |
| 31 | +# linux/amd64,linux/arm64 just like the other images, so both must resolve. |
| 32 | +case "$(uname -m)" in |
| 33 | + x86_64) ARCH=x64 ;; |
| 34 | + aarch64) ARCH=arm64 ;; |
| 35 | + *) echo "ERROR: unsupported arch $(uname -m)" >&2; exit 1 ;; |
| 36 | +esac |
| 37 | + |
| 38 | +NAME="openvscode-server-v${TAG}-linux-${ARCH}" |
| 39 | +URL="https://github.com/gitpod-io/openvscode-server/releases/download/openvscode-server-v${TAG}/${NAME}.tar.gz" |
| 40 | +echo "Installing ${NAME}" |
| 41 | + |
| 42 | +mkdir -p /opt |
| 43 | +curl -fsSL "${URL}" | tar -xz -C /opt |
| 44 | +mv "/opt/${NAME}" /opt/openvscode-server |
| 45 | +ln -sf /opt/openvscode-server/bin/openvscode-server /usr/local/bin/openvscode-server |
| 46 | + |
| 47 | +# Fail the build loudly if the binary doesn't run on this arch, rather than |
| 48 | +# shipping an image whose "VS Code" tile dies at spawn time. |
| 49 | +openvscode-server --version |
| 50 | + |
| 51 | +# The base CPU image already installed Anthropic.claude-code into the shared |
| 52 | +# extensions dir that jupyter-vscode-proxy passes via --extensions-dir |
| 53 | +# (${CODE_EXTENSIONSDIR}). openvscode-server reads that same dir with the same |
| 54 | +# standard VSIX layout, so the Claude extension is inherited — no reinstall here |
| 55 | +# (avoids a marketplace round-trip in CI). Confirm it's present so a missing |
| 56 | +# extension surfaces at build time, not when a user opens the panel on a tablet. |
| 57 | +EXT_DIR="${CODE_EXTENSIONSDIR:-/opt/share/code-server}" |
| 58 | +ls "${EXT_DIR}" | grep -qi 'anthropic.claude-code' \ |
| 59 | + || { echo "ERROR: Anthropic.claude-code not found in ${EXT_DIR}" >&2; \ |
| 60 | + ls -la "${EXT_DIR}" 2>&1 || true; exit 1; } |
0 commit comments