feat(code-server): add use_cached_extensions option

pull/259/head
Michael Brewer 1 year ago
parent 484fc2747f
commit 7f40af0e62
No known key found for this signature in database
GPG Key ID: D7A137BA1254AFC7

@ -95,6 +95,12 @@ variable "use_cached" {
default = false
}
variable "use_cached_extensions" {
type = bool
description = "Uses cached copy of extensions, otherwise do a forced upgrade"
default = false
}
variable "extensions_dir" {
type = string
description = "Override the directory to store extensions in."
@ -122,6 +128,7 @@ resource "coder_script" "code-server" {
SETTINGS : replace(jsonencode(var.settings), "\"", "\\\""),
OFFLINE : var.offline,
USE_CACHED : var.use_cached,
USE_CACHED_EXTENSIONS : var.use_cached_extensions,
EXTENSIONS_DIR : var.extensions_dir,
FOLDER : var.folder,
AUTO_INSTALL_EXTENSIONS : var.auto_install_extensions,

@ -19,7 +19,7 @@ function run_code_server() {
}
function extension_installed() {
if [ "${USE_CACHED}" != true ]; then
if [ "${USE_CACHED_EXTENSIONS}" != true ]; then
return 1
fi
if [ -z "${EXTENSIONS_DIR}" ]; then
@ -89,7 +89,7 @@ for extension in "$${EXTENSIONLIST[@]}"; do
continue
fi
printf "🧩 Installing extension $${CODE}$extension$${RESET}...\n"
output=$($CODE_SERVER "$EXTENSION_ARG" --install-extension "$extension")
output=$($CODE_SERVER "$EXTENSION_ARG" --force --install-extension "$extension")
if [ $? -ne 0 ]; then
echo "Failed to install extension: $extension: $output"
exit 1
@ -114,7 +114,7 @@ if [ "${AUTO_INSTALL_EXTENSIONS}" = true ]; then
if extension_installed "$extension"; then
continue
fi
$CODE_SERVER "$EXTENSION_ARG" --install-extension "$extension"
$CODE_SERVER "$EXTENSION_ARG" --force --install-extension "$extension"
done
fi
fi

Loading…
Cancel
Save