From f553d3e6bf20b573b31d6810e3bbbafd7ef1e493 Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Mon, 16 Feb 2026 10:17:10 +0530 Subject: [PATCH 1/7] feat(jetbrains): add plugin pre-installation support --- registry/coder/modules/jetbrains/README.md | 38 +++++- .../modules/jetbrains/jetbrains.tftest.hcl | 34 +++++ registry/coder/modules/jetbrains/main.tf | 66 +++++++++- .../jetbrains/script/install_plugins.sh | 118 ++++++++++++++++++ 4 files changed, 254 insertions(+), 2 deletions(-) create mode 100644 registry/coder/modules/jetbrains/script/install_plugins.sh diff --git a/registry/coder/modules/jetbrains/README.md b/registry/coder/modules/jetbrains/README.md index cf97d127e..e0f8467ba 100644 --- a/registry/coder/modules/jetbrains/README.md +++ b/registry/coder/modules/jetbrains/README.md @@ -136,6 +136,42 @@ module "jetbrains" { } ``` +### Plugin Auto‑Installer + +This module now supports automatic JetBrains plugin installation inside your workspace. + +To get a plugin ID, open the plugin’s page on the JetBrains Marketplace. Scroll down to Additional Information and look for Plugin ID. Use that value in the configuration below. + +```tf +module "jetbrains" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/coder/jetbrains/coder" + version = "1.2.1" + agent_id = coder_agent.main.id + folder = "/home/coder/project" + default = ["IU", "PY"] + + jetbrains_plugins = { + "PY" = ["com.koxudaxi.pydantic", "com.intellij.kubernetes"] + "IU" = ["", ""] + "WS" = ["", ""] + "GO" = ["", ""] + "CL" = ["", ""] + "PS" = ["", ""] + "RD" = ["", ""] + "RM" = ["", ""] + "RR" = ["", ""] + } +} +``` + +> [!IMPORTANT] +> This module prerequisites and limitations +> +> 1. Requires JetBrains Toolbox to be installed +> 2. Requires jq and zip to be available +> 3. Only works on Debian/Ubuntu-based systems (due to apt-get usage) + ### Accessing the IDE Metadata You can now reference the output `ide_metadata` as a map. @@ -181,4 +217,4 @@ All JetBrains IDEs with remote development capabilities: - [Rider (`RD`)](https://www.jetbrains.com/rider/) - [RubyMine (`RM`)](https://www.jetbrains.com/ruby/) - [RustRover (`RR`)](https://www.jetbrains.com/rust/) -- [WebStorm (`WS`)](https://www.jetbrains.com/webstorm/) +- [WebStorm (`WS`)](https://www.jetbrains.com/webstorm/) \ No newline at end of file diff --git a/registry/coder/modules/jetbrains/jetbrains.tftest.hcl b/registry/coder/modules/jetbrains/jetbrains.tftest.hcl index dba9551da..a415e911c 100644 --- a/registry/coder/modules/jetbrains/jetbrains.tftest.hcl +++ b/registry/coder/modules/jetbrains/jetbrains.tftest.hcl @@ -351,3 +351,37 @@ run "validate_output_schema" { error_message = "The ide_metadata output schema has changed. Please update the 'main.tf' and this test." } } + +run "no_plugin_script_when_plugins_empty" { + command = plan + + variables { + agent_id = "foo" + folder = "/home/coder" + default = ["PY"] + jetbrains_plugins = {} + } + + assert { + condition = length(resource.coder_script.install_jetbrains_plugins) == 0 + error_message = "Expected no plugin install script when plugins list is empty" +} +} + +run "plugin_script_created_when_plugins_provided" { + command = plan + + variables { + agent_id = "foo" + folder = "/home/coder" + default = ["PY"] + jetbrains_plugins = { + "PY" = ["com.koxudaxi.pydantic", "com.intellij.kubernetes"] + } + } + + assert { + condition = length(values(resource.coder_script.install_jetbrains_plugins)) == 1 + error_message = "Expected script to be created when plugins are provided" + } +} \ No newline at end of file diff --git a/registry/coder/modules/jetbrains/main.tf b/registry/coder/modules/jetbrains/main.tf index 2fac060f1..8014a88d5 100644 --- a/registry/coder/modules/jetbrains/main.tf +++ b/registry/coder/modules/jetbrains/main.tf @@ -173,6 +173,13 @@ variable "ide_config" { } } +variable "jetbrains_plugins" { + type = map(list(string)) + description = "Map of IDE product codes to plugin ID lists. Example: { IU = [\"com.foo\"], GO = [\"org.bar\"] }." + default = {} +} + + locals { # Parse HTTP responses once with error handling for air-gapped environments parsed_responses = { @@ -214,6 +221,12 @@ locals { # Convert the parameter value to a set for for_each selected_ides = length(var.default) == 0 ? toset(jsondecode(coalesce(data.coder_parameter.jetbrains_ides[0].value, "[]"))) : toset(var.default) + + plugin_map_b64 = base64encode(jsonencode(var.jetbrains_plugins)) + + plugin_install_script = file("${path.module}/script/install_plugins.sh") + + ide_config_b64 = base64encode(jsonencode(var.ide_config)) } data "coder_parameter" "jetbrains_ides" { @@ -241,6 +254,57 @@ data "coder_parameter" "jetbrains_ides" { data "coder_workspace" "me" {} data "coder_workspace_owner" "me" {} +resource "coder_script" "store_plugins" { + count = length(var.jetbrains_plugins) > 0 ? 1 : 0 + agent_id = var.agent_id + display_name = "Store JetBrains Plugins List" + run_on_start = true + script = <<-EOT + #!/bin/sh + set -eu + + mkdir -p "$HOME/.config/jetbrains" + echo -n "${local.plugin_map_b64}" | base64 -d > "$HOME/.config/jetbrains/plugins.json" + chmod 600 "$HOME/.config/jetbrains/plugins.json" + EOT +} + +resource "coder_script" "store_ide_config" { + agent_id = var.agent_id + display_name = "Store JetBrains IDE Config" + run_on_start = true + + script = <<-EOT + #!/bin/sh + set -eu + + CONFIG_DIR="$HOME/.config/jetbrains" + CONFIG_FILE="$CONFIG_DIR/ide_config.json" + + mkdir -p "$CONFIG_DIR" + echo -n "${local.ide_config_b64}" | base64 -d > "$CONFIG_FILE" + chmod 600 "$CONFIG_FILE" + EOT +} + +resource "coder_script" "install_jetbrains_plugins" { + count = length(var.jetbrains_plugins) > 0 ? 1 : 0 + agent_id = var.agent_id + display_name = "Install JetBrains Plugins" + run_on_start = true + depends_on = [coder_script.store_plugins] + + script = <<-EOT + #!/bin/bash + set -o errexit + set -o pipefail + echo -n '${base64encode(local.plugin_install_script)}' | base64 -d > /tmp/install_plugins.sh + chmod +x /tmp/install_plugins.sh + nohup /tmp/install_plugins.sh > /tmp/install_plugins.log 2>&1 & + exit 0 + EOT +} + resource "coder_app" "jetbrains" { for_each = local.selected_ides agent_id = var.agent_id @@ -277,4 +341,4 @@ output "ide_metadata" { # 'key' will be the IDE key (e.g., "IC", "PY") for key, val in local.selected_ides : key => local.options_metadata[key] } -} +} \ No newline at end of file diff --git a/registry/coder/modules/jetbrains/script/install_plugins.sh b/registry/coder/modules/jetbrains/script/install_plugins.sh new file mode 100644 index 000000000..265bad565 --- /dev/null +++ b/registry/coder/modules/jetbrains/script/install_plugins.sh @@ -0,0 +1,118 @@ +#!/bin/bash +set -euo pipefail + +LOGFILE="$HOME/.config/jetbrains/install_plugins.log" +CONFIG_DIR="$HOME/.config/jetbrains" +IDE_CONFIG="$CONFIG_DIR/ide_config.json" +PLUGIN_MAP="$CONFIG_DIR/plugins.json" +IDE_BASE="$HOME/.local/share/JetBrains" + +mkdir -p "$CONFIG_DIR" +exec > >(tee -a "$LOGFILE") 2>&1 + +log() { + printf '%s %s\n' "$(date --iso-8601=seconds)" "$*" +} + +# ---------- Read config ---------- +get_enabled_codes() { + jq -r 'keys[]' "$PLUGIN_MAP" +} + +get_plugins_for_code() { + jq -r --arg CODE "$1" '.[$CODE][]?' "$PLUGIN_MAP" +} + +get_build_for_code() { + jq -r --arg CODE "$1" '.[$CODE].build' "$IDE_CONFIG" +} + +get_data_dir_for_code() { + local code="$1" + local build="$2" + + local name + local build_prefix + local year + local minor + + name="$(jq -r --arg CODE "$code" '.[$CODE].name' "$IDE_CONFIG")" + + # build = 253.29346.142 → prefix = 253 + build_prefix="${build%%.*}" + + # 253 → 2025.3 + year="20${build_prefix:0:2}" + minor="${build_prefix:2:1}" + + printf '%s%s.%s\n' "$name" "$year" "$minor" +} + +# ---------- Plugin installer ---------- +install_plugin() { + local code="$1" + local build="$2" + local dataDir="$3" + local pluginId="$4" + + local plugins_dir="$IDE_BASE/$dataDir" + mkdir -p "$plugins_dir" + + local url="https://plugins.jetbrains.com/pluginManager?action=download&id=$pluginId&build=$code-$build" + + local workdir + workdir="$(mktemp -d)" + cd "$workdir" + + log "Downloading $pluginId ($code-$build)" + + if ! curl -fsSL -OJ "$url"; then + log "Download failed: $pluginId" + rm -rf "$workdir" + return 1 + fi + + # We expect exactly one file after download + file="$(ls)" + + # ---------- ZIP plugin ---------- + if unzip -t "$file" >/dev/null 2>&1; then + unzip -qq "$file" + + entries=(*) + log "Extracted $file, found entries: ${entries[*]}" + + if [ -d "${entries[0]}" ] && [ -d "${entries[0]}/lib" ]; then + cp -r "${entries[0]}" "$plugins_dir/" + log "Installed ZIP plugin $pluginId" + elif [[ "$file" == *.jar ]]; then + cp "$file" "$plugins_dir/" + log "Installed JAR plugin $pluginId" + fi + fi + + cd / + rm -rf "$workdir" +} + +# ---------- Main ---------- +log "Plugin installer started (build-based mode)" + +[ ! -f "$PLUGIN_MAP" ] && log "No plugins.json found" && exit 0 +[ ! -f "$IDE_CONFIG" ] && log "No ide_config.json found" && exit 0 + +get_enabled_codes | while read -r code; do + build="$(get_build_for_code "$code")" + dataDir="$(get_data_dir_for_code "$code" "$build")" + + if [ -z "$build" ] || [ -z "$dataDir" ]; then + log "Missing config for $code, skipping" + continue + fi + + get_plugins_for_code "$code" | while read -r plugin; do + [ -n "$plugin" ] && install_plugin "$code" "$build" "$dataDir" "$plugin" || continue + done +done + +log "All plugins processed" From 2b228057b7dbe3a983b8e93d41506fbe7b3388fc Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Mon, 16 Feb 2026 13:40:29 +0530 Subject: [PATCH 2/7] fix: terraform test file --- registry/coder/modules/jetbrains/README.md | 2 +- .../modules/jetbrains/jetbrains.tftest.hcl | 20 +++++++++---------- registry/coder/modules/jetbrains/main.tf | 4 ++-- .../jetbrains/script/install_plugins.sh | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/registry/coder/modules/jetbrains/README.md b/registry/coder/modules/jetbrains/README.md index e0f8467ba..55afcfc90 100644 --- a/registry/coder/modules/jetbrains/README.md +++ b/registry/coder/modules/jetbrains/README.md @@ -217,4 +217,4 @@ All JetBrains IDEs with remote development capabilities: - [Rider (`RD`)](https://www.jetbrains.com/rider/) - [RubyMine (`RM`)](https://www.jetbrains.com/ruby/) - [RustRover (`RR`)](https://www.jetbrains.com/rust/) -- [WebStorm (`WS`)](https://www.jetbrains.com/webstorm/) \ No newline at end of file +- [WebStorm (`WS`)](https://www.jetbrains.com/webstorm/) diff --git a/registry/coder/modules/jetbrains/jetbrains.tftest.hcl b/registry/coder/modules/jetbrains/jetbrains.tftest.hcl index a415e911c..973a74295 100644 --- a/registry/coder/modules/jetbrains/jetbrains.tftest.hcl +++ b/registry/coder/modules/jetbrains/jetbrains.tftest.hcl @@ -356,32 +356,32 @@ run "no_plugin_script_when_plugins_empty" { command = plan variables { - agent_id = "foo" - folder = "/home/coder" - default = ["PY"] - jetbrains_plugins = {} + agent_id = "foo" + folder = "/home/coder" + default = ["PY"] + jetbrains_plugins = {} } assert { condition = length(resource.coder_script.install_jetbrains_plugins) == 0 error_message = "Expected no plugin install script when plugins list is empty" -} + } } run "plugin_script_created_when_plugins_provided" { command = plan variables { - agent_id = "foo" - folder = "/home/coder" - default = ["PY"] + agent_id = "foo" + folder = "/home/coder" + default = ["PY"] jetbrains_plugins = { - "PY" = ["com.koxudaxi.pydantic", "com.intellij.kubernetes"] + "PY" = ["com.koxudaxi.pydantic", "com.intellij.kubernetes"] } } assert { - condition = length(values(resource.coder_script.install_jetbrains_plugins)) == 1 + condition = length(resource.coder_script.install_jetbrains_plugins) == 1 error_message = "Expected script to be created when plugins are provided" } } \ No newline at end of file diff --git a/registry/coder/modules/jetbrains/main.tf b/registry/coder/modules/jetbrains/main.tf index 8014a88d5..dbcc3dbaf 100644 --- a/registry/coder/modules/jetbrains/main.tf +++ b/registry/coder/modules/jetbrains/main.tf @@ -285,13 +285,13 @@ resource "coder_script" "store_ide_config" { echo -n "${local.ide_config_b64}" | base64 -d > "$CONFIG_FILE" chmod 600 "$CONFIG_FILE" EOT -} +} resource "coder_script" "install_jetbrains_plugins" { count = length(var.jetbrains_plugins) > 0 ? 1 : 0 agent_id = var.agent_id display_name = "Install JetBrains Plugins" - run_on_start = true + run_on_start = true depends_on = [coder_script.store_plugins] script = <<-EOT diff --git a/registry/coder/modules/jetbrains/script/install_plugins.sh b/registry/coder/modules/jetbrains/script/install_plugins.sh index 265bad565..0ade419f2 100644 --- a/registry/coder/modules/jetbrains/script/install_plugins.sh +++ b/registry/coder/modules/jetbrains/script/install_plugins.sh @@ -76,7 +76,7 @@ install_plugin() { file="$(ls)" # ---------- ZIP plugin ---------- - if unzip -t "$file" >/dev/null 2>&1; then + if unzip -t "$file" > /dev/null 2>&1; then unzip -qq "$file" entries=(*) From 81db815d8655130e10fe40b5cd15c4a9d6d69e9c Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Wed, 18 Feb 2026 17:44:54 +0530 Subject: [PATCH 3/7] fix: sync all scripts execution order --- registry/coder/modules/jetbrains/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder/modules/jetbrains/main.tf b/registry/coder/modules/jetbrains/main.tf index dbcc3dbaf..338ac5aaf 100644 --- a/registry/coder/modules/jetbrains/main.tf +++ b/registry/coder/modules/jetbrains/main.tf @@ -292,7 +292,7 @@ resource "coder_script" "install_jetbrains_plugins" { agent_id = var.agent_id display_name = "Install JetBrains Plugins" run_on_start = true - depends_on = [coder_script.store_plugins] + depends_on = [coder_script.store_plugins, coder_script.store_ide_config] script = <<-EOT #!/bin/bash From e256d3e4b0b6a697db590d92708315645f27896d Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Wed, 18 Feb 2026 20:02:15 +0530 Subject: [PATCH 4/7] fix: merge all coder_scripts --- registry/coder/modules/jetbrains/main.tf | 42 +++++------------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/registry/coder/modules/jetbrains/main.tf b/registry/coder/modules/jetbrains/main.tf index 338ac5aaf..3b211ffd7 100644 --- a/registry/coder/modules/jetbrains/main.tf +++ b/registry/coder/modules/jetbrains/main.tf @@ -254,50 +254,26 @@ data "coder_parameter" "jetbrains_ides" { data "coder_workspace" "me" {} data "coder_workspace_owner" "me" {} -resource "coder_script" "store_plugins" { +resource "coder_script" "install_jetbrains_plugins" { count = length(var.jetbrains_plugins) > 0 ? 1 : 0 agent_id = var.agent_id - display_name = "Store JetBrains Plugins List" - run_on_start = true - script = <<-EOT - #!/bin/sh - set -eu - - mkdir -p "$HOME/.config/jetbrains" - echo -n "${local.plugin_map_b64}" | base64 -d > "$HOME/.config/jetbrains/plugins.json" - chmod 600 "$HOME/.config/jetbrains/plugins.json" - EOT -} - -resource "coder_script" "store_ide_config" { - agent_id = var.agent_id - display_name = "Store JetBrains IDE Config" + display_name = "Install JetBrains Plugins" run_on_start = true script = <<-EOT - #!/bin/sh - set -eu + #!/bin/bash + set -o errexit + set -o pipefail CONFIG_DIR="$HOME/.config/jetbrains" - CONFIG_FILE="$CONFIG_DIR/ide_config.json" mkdir -p "$CONFIG_DIR" - echo -n "${local.ide_config_b64}" | base64 -d > "$CONFIG_FILE" - chmod 600 "$CONFIG_FILE" - EOT -} + echo -n "${local.plugin_map_b64}" | base64 -d > "$CONFIG_DIR/plugins.json" + chmod 600 "$CONFIG_DIR/plugins.json" -resource "coder_script" "install_jetbrains_plugins" { - count = length(var.jetbrains_plugins) > 0 ? 1 : 0 - agent_id = var.agent_id - display_name = "Install JetBrains Plugins" - run_on_start = true - depends_on = [coder_script.store_plugins, coder_script.store_ide_config] + echo -n "${local.ide_config_b64}" | base64 -d > "$CONFIG_DIR/ide_config.json" + chmod 600 "$CONFIG_DIR/ide_config.json" - script = <<-EOT - #!/bin/bash - set -o errexit - set -o pipefail echo -n '${base64encode(local.plugin_install_script)}' | base64 -d > /tmp/install_plugins.sh chmod +x /tmp/install_plugins.sh nohup /tmp/install_plugins.sh > /tmp/install_plugins.log 2>&1 & From ac041ff1caefd9c956018437fd1461f71dfe011e Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Thu, 19 Feb 2026 13:30:34 +0530 Subject: [PATCH 5/7] style: enhance install_plugin logs style --- .../modules/jetbrains/script/install_plugins.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/registry/coder/modules/jetbrains/script/install_plugins.sh b/registry/coder/modules/jetbrains/script/install_plugins.sh index 0ade419f2..39274b300 100644 --- a/registry/coder/modules/jetbrains/script/install_plugins.sh +++ b/registry/coder/modules/jetbrains/script/install_plugins.sh @@ -27,6 +27,10 @@ get_build_for_code() { jq -r --arg CODE "$1" '.[$CODE].build' "$IDE_CONFIG" } +get_name_for_code() { + jq -r --arg CODE "$1" '.[$CODE].name' "$IDE_CONFIG" +} + get_data_dir_for_code() { local code="$1" local build="$2" @@ -36,7 +40,7 @@ get_data_dir_for_code() { local year local minor - name="$(jq -r --arg CODE "$code" '.[$CODE].name' "$IDE_CONFIG")" + name="$(get_name_for_code "$code")" # build = 253.29346.142 → prefix = 253 build_prefix="${build%%.*}" @@ -55,6 +59,9 @@ install_plugin() { local dataDir="$3" local pluginId="$4" + local name + name="$(get_name_for_code "$code")" + local plugins_dir="$IDE_BASE/$dataDir" mkdir -p "$plugins_dir" @@ -64,7 +71,7 @@ install_plugin() { workdir="$(mktemp -d)" cd "$workdir" - log "Downloading $pluginId ($code-$build)" + log "[$name]" "Downloading $pluginId ($code-$build)" if ! curl -fsSL -OJ "$url"; then log "Download failed: $pluginId" @@ -80,14 +87,14 @@ install_plugin() { unzip -qq "$file" entries=(*) - log "Extracted $file, found entries: ${entries[*]}" + log "[$name]" "Extracted $file, found entries: ${entries[*]}" if [ -d "${entries[0]}" ] && [ -d "${entries[0]}/lib" ]; then cp -r "${entries[0]}" "$plugins_dir/" - log "Installed ZIP plugin $pluginId" + log "[$name]" "Installed ZIP plugin $pluginId" elif [[ "$file" == *.jar ]]; then cp "$file" "$plugins_dir/" - log "Installed JAR plugin $pluginId" + log "[$name]" "Installed JAR plugin $pluginId" fi fi From 673a2e876b66ff3695aeb60c31f7375fa87187e6 Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Thu, 19 Feb 2026 20:25:54 +0530 Subject: [PATCH 6/7] fix: hardcoded the name and build number for IDE --- registry/coder/modules/jetbrains/main.tf | 5 ---- .../jetbrains/script/install_plugins.sh | 28 ++++++++++++++++--- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/registry/coder/modules/jetbrains/main.tf b/registry/coder/modules/jetbrains/main.tf index 3b211ffd7..cd92091b7 100644 --- a/registry/coder/modules/jetbrains/main.tf +++ b/registry/coder/modules/jetbrains/main.tf @@ -225,8 +225,6 @@ locals { plugin_map_b64 = base64encode(jsonencode(var.jetbrains_plugins)) plugin_install_script = file("${path.module}/script/install_plugins.sh") - - ide_config_b64 = base64encode(jsonencode(var.ide_config)) } data "coder_parameter" "jetbrains_ides" { @@ -271,9 +269,6 @@ resource "coder_script" "install_jetbrains_plugins" { echo -n "${local.plugin_map_b64}" | base64 -d > "$CONFIG_DIR/plugins.json" chmod 600 "$CONFIG_DIR/plugins.json" - echo -n "${local.ide_config_b64}" | base64 -d > "$CONFIG_DIR/ide_config.json" - chmod 600 "$CONFIG_DIR/ide_config.json" - echo -n '${base64encode(local.plugin_install_script)}' | base64 -d > /tmp/install_plugins.sh chmod +x /tmp/install_plugins.sh nohup /tmp/install_plugins.sh > /tmp/install_plugins.log 2>&1 & diff --git a/registry/coder/modules/jetbrains/script/install_plugins.sh b/registry/coder/modules/jetbrains/script/install_plugins.sh index 39274b300..45361982d 100644 --- a/registry/coder/modules/jetbrains/script/install_plugins.sh +++ b/registry/coder/modules/jetbrains/script/install_plugins.sh @@ -3,7 +3,6 @@ set -euo pipefail LOGFILE="$HOME/.config/jetbrains/install_plugins.log" CONFIG_DIR="$HOME/.config/jetbrains" -IDE_CONFIG="$CONFIG_DIR/ide_config.json" PLUGIN_MAP="$CONFIG_DIR/plugins.json" IDE_BASE="$HOME/.local/share/JetBrains" @@ -24,11 +23,33 @@ get_plugins_for_code() { } get_build_for_code() { - jq -r --arg CODE "$1" '.[$CODE].build' "$IDE_CONFIG" + case "$1" in + CL) echo "253.29346.141" ;; + GO) echo "253.28294.337" ;; + IU) echo "253.29346.138" ;; + PS) echo "253.29346.151" ;; + PY) echo "253.29346.142" ;; + RD) echo "253.29346.144" ;; + RM) echo "253.29346.140" ;; + RR) echo "253.29346.139" ;; + WS) echo "253.29346.143" ;; + *) return 1 ;; + esac } get_name_for_code() { - jq -r --arg CODE "$1" '.[$CODE].name' "$IDE_CONFIG" + case "$1" in + CL) echo "CLion" ;; + GO) echo "GoLand" ;; + IU) echo "IntelliJIdea" ;; + PS) echo "PhpStorm" ;; + PY) echo "PyCharm" ;; + RD) echo "Rider" ;; + RM) echo "RubyMine" ;; + RR) echo "ReSharper" ;; + WS) echo "WebStorm" ;; + *) return 1 ;; + esac } get_data_dir_for_code() { @@ -106,7 +127,6 @@ install_plugin() { log "Plugin installer started (build-based mode)" [ ! -f "$PLUGIN_MAP" ] && log "No plugins.json found" && exit 0 -[ ! -f "$IDE_CONFIG" ] && log "No ide_config.json found" && exit 0 get_enabled_codes | while read -r code; do build="$(get_build_for_code "$code")" From 400eef62284f62d2b714a5bf82c71380a9299e02 Mon Sep 17 00:00:00 2001 From: Harsh panwar Date: Thu, 19 Feb 2026 21:41:20 +0530 Subject: [PATCH 7/7] fix: get build number from ide_config.json --- registry/coder/modules/jetbrains/main.tf | 5 +++++ .../modules/jetbrains/script/install_plugins.sh | 17 ++++------------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/registry/coder/modules/jetbrains/main.tf b/registry/coder/modules/jetbrains/main.tf index cd92091b7..3b211ffd7 100644 --- a/registry/coder/modules/jetbrains/main.tf +++ b/registry/coder/modules/jetbrains/main.tf @@ -225,6 +225,8 @@ locals { plugin_map_b64 = base64encode(jsonencode(var.jetbrains_plugins)) plugin_install_script = file("${path.module}/script/install_plugins.sh") + + ide_config_b64 = base64encode(jsonencode(var.ide_config)) } data "coder_parameter" "jetbrains_ides" { @@ -269,6 +271,9 @@ resource "coder_script" "install_jetbrains_plugins" { echo -n "${local.plugin_map_b64}" | base64 -d > "$CONFIG_DIR/plugins.json" chmod 600 "$CONFIG_DIR/plugins.json" + echo -n "${local.ide_config_b64}" | base64 -d > "$CONFIG_DIR/ide_config.json" + chmod 600 "$CONFIG_DIR/ide_config.json" + echo -n '${base64encode(local.plugin_install_script)}' | base64 -d > /tmp/install_plugins.sh chmod +x /tmp/install_plugins.sh nohup /tmp/install_plugins.sh > /tmp/install_plugins.log 2>&1 & diff --git a/registry/coder/modules/jetbrains/script/install_plugins.sh b/registry/coder/modules/jetbrains/script/install_plugins.sh index 45361982d..30f228966 100644 --- a/registry/coder/modules/jetbrains/script/install_plugins.sh +++ b/registry/coder/modules/jetbrains/script/install_plugins.sh @@ -3,6 +3,7 @@ set -euo pipefail LOGFILE="$HOME/.config/jetbrains/install_plugins.log" CONFIG_DIR="$HOME/.config/jetbrains" +IDE_CONFIG="$CONFIG_DIR/ide_config.json" PLUGIN_MAP="$CONFIG_DIR/plugins.json" IDE_BASE="$HOME/.local/share/JetBrains" @@ -23,18 +24,7 @@ get_plugins_for_code() { } get_build_for_code() { - case "$1" in - CL) echo "253.29346.141" ;; - GO) echo "253.28294.337" ;; - IU) echo "253.29346.138" ;; - PS) echo "253.29346.151" ;; - PY) echo "253.29346.142" ;; - RD) echo "253.29346.144" ;; - RM) echo "253.29346.140" ;; - RR) echo "253.29346.139" ;; - WS) echo "253.29346.143" ;; - *) return 1 ;; - esac + jq -r --arg CODE "$1" '.[$CODE].build' "$IDE_CONFIG" } get_name_for_code() { @@ -46,7 +36,7 @@ get_name_for_code() { PY) echo "PyCharm" ;; RD) echo "Rider" ;; RM) echo "RubyMine" ;; - RR) echo "ReSharper" ;; + RR) echo "RustRover" ;; WS) echo "WebStorm" ;; *) return 1 ;; esac @@ -127,6 +117,7 @@ install_plugin() { log "Plugin installer started (build-based mode)" [ ! -f "$PLUGIN_MAP" ] && log "No plugins.json found" && exit 0 +[ ! -f "$IDE_CONFIG" ] && log "No ide_config.json found" && exit 0 get_enabled_codes | while read -r code; do build="$(get_build_for_code "$code")"