Open michaelbrewer opened 3 months ago
In some cases auto_install_extensions won't if the workspace has not been checkout yet.
auto_install_extensions
Ideally coder should provide a method to wait on a dependent task from completing.
A work around is to poll for the folder to be created before running the install like so.
if [ "${AUTO_INSTALL_EXTENSIONS}" = true ]; then if ! command -v jq > /dev/null; then echo "jq is required to install extensions from a workspace file." exit 0 fi WORKSPACE_DIR="$HOME" if [ -n "${FOLDER}" ]; then WORKSPACE_DIR="${FOLDER}" fi TIMEOUT=10 INTERVAL=1 ELAPSED=0 while [ $ELAPSED -lt $TIMEOUT ]; do if [ -d "$WORKSPACE_DIR" ]; then echo "Directory $WORKSPACE_DIR exists." break fi sleep $INTERVAL ELAPSED=$((ELAPSED + INTERVAL)) done if [ -f "$WORKSPACE_DIR/.vscode/extensions.json" ]; then printf "🧩 Installing extensions from %s/.vscode/extensions.json...\n" "$WORKSPACE_DIR" extensions=$(jq -r '.recommendations[]' "$WORKSPACE_DIR"/.vscode/extensions.json) for extension in $extensions; do if extension_installed "$extension"; then continue fi $CODE_SERVER "$EXTENSION_ARG" --force --install-extension "$extension" done fi fi
In some cases
auto_install_extensions
won't if the workspace has not been checkout yet.Ideally coder should provide a method to wait on a dependent task from completing.
A work around is to poll for the folder to be created before running the install like so.