Skip to content

Commit d99c770

Browse files
committed
Refactor JetBrains module for air-gapped support
- Improved logic for handling air-gapped environments by utilizing fallback mechanisms in JetBrains integrations. - Updated parameters and default settings to align with the new connectivity conditions, ensuring robustness in varied network scenarios. - Expanded tests to validate custom configurations even when API access is restricted, confirming consistent behavior across setups.
1 parent e54ca31 commit d99c770

File tree

6 files changed

+600
-128
lines changed

6 files changed

+600
-128
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "registry",
33
"scripts": {
4-
"fmt": "bun x prettier --write **/*.sh **/*.ts **/*.md *.md && terraform fmt -recursive -diff",
5-
"fmt:ci": "bun x prettier --check **/*.sh **/*.ts **/*.md *.md && terraform fmt -check -recursive -diff",
4+
"fmt": "bun x prettier --write **/*.sh **/*.ts **/main.test.ts **/*.md *.md && terraform fmt -recursive -diff",
5+
"fmt:ci": "bun x prettier --check **/*.sh **/*.ts **/main.test.ts **/*.md *.md && terraform fmt -check -recursive -diff",
66
"terraform-validate": "./scripts/terraform_validate.sh",
77
"test": "bun test",
88
"update-version": "./update-version.sh"

registry/coder/modules/filebrowser/main.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ describe("filebrowser", async () => {
8484
"sh",
8585
"apk add bash",
8686
);
87-
8887
}, 15000);
8988

9089
it("runs with subdomain=false", async () => {

registry/coder/modules/jetbrains/README.md

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
---
2-
display_name: JetBrains IDEs
2+
display_name: JetBrains Toolbox
33
description: Add JetBrains IDE integrations to your Coder workspaces with configurable options.
44
icon: ../.icons/jetbrains.svg
5-
maintainer_github: coder
6-
partner_github: jetbrains
75
verified: true
86
tags: [ide, jetbrains, parameter]
97
---
@@ -22,6 +20,9 @@ module "jetbrains" {
2220
}
2321
```
2422

23+
> [!NOTE]
24+
> This module requires Coder version 2.24+ to use the `multi-select` form type.
25+
2526
> [!WARNING]
2627
> JetBrains recommends a minimum of 4 CPU cores and 8GB of RAM.
2728
> Consult the [JetBrains documentation](https://www.jetbrains.com/help/idea/prerequisites.html#min_requirements) to confirm other system requirements.
@@ -89,7 +90,7 @@ module "jetbrains" {
8990
"GO" = {
9091
name = "GoLand"
9192
icon = "/custom/icons/goland.svg"
92-
build = "251.25410.140" # Note: build numbers are fetched from API, not used
93+
build = "251.25410.140"
9394
}
9495
"PY" = {
9596
name = "PyCharm"
@@ -105,7 +106,11 @@ module "jetbrains" {
105106
}
106107
```
107108

108-
### Offline Mode
109+
### Air-Gapped and Offline Environments
110+
111+
This module supports air-gapped environments through automatic fallback mechanisms:
112+
113+
#### Option 1: Self-hosted JetBrains API Mirror
109114

110115
For organizations with internal JetBrains API mirrors:
111116

@@ -125,6 +130,42 @@ module "jetbrains" {
125130
}
126131
```
127132

133+
#### Option 2: Fully Air-Gapped (No Internet Access)
134+
135+
The module automatically falls back to static build numbers from `ide_config` when the JetBrains API is unreachable:
136+
137+
```tf
138+
module "jetbrains" {
139+
count = data.coder_workspace.me.start_count
140+
source = "registry.coder.com/coder/jetbrains/coder"
141+
version = "1.0.0"
142+
agent_id = coder_agent.example.id
143+
folder = "/home/coder/project"
144+
145+
default = ["GO", "IU"]
146+
147+
# Update these build numbers as needed for your environment
148+
ide_config = {
149+
"GO" = {
150+
name = "GoLand"
151+
icon = "/icon/goland.svg"
152+
build = "251.25410.140" # Static build number used when API is unavailable
153+
}
154+
"IU" = {
155+
name = "IntelliJ IDEA"
156+
icon = "/icon/intellij.svg"
157+
build = "251.23774.200" # Static build number used when API is unavailable
158+
}
159+
}
160+
}
161+
```
162+
163+
**How it works:**
164+
165+
- The module first attempts to fetch the latest build numbers from the JetBrains API
166+
- If the API is unreachable (network timeout, DNS failure, etc.), it automatically falls back to the build numbers specified in `ide_config`
167+
- This ensures the module works in both connected and air-gapped environments without configuration changes
168+
128169
### Single IDE for Specific Use Case
129170

130171
```tf
@@ -152,8 +193,9 @@ module "jetbrains_goland" {
152193

153194
### Version Resolution
154195

155-
- Build numbers are always fetched from the JetBrains API for the latest compatible versions
156-
- `major_version` and `channel` control which API endpoint is queried
196+
- Build numbers are fetched from the JetBrains API for the latest compatible versions when internet access is available
197+
- If the API is unreachable (air-gapped environments), the module automatically falls back to build numbers from `ide_config`
198+
- `major_version` and `channel` control which API endpoint is queried (when API access is available)
157199

158200
## Supported IDEs
159201

0 commit comments

Comments
 (0)