-
Notifications
You must be signed in to change notification settings - Fork 11
feat(fleet-ide): add Fleet IDE module for JetBrains integration #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
DevelopmentCats
wants to merge
10
commits into
main
Choose a base branch
from
cat/fleet-ide
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+294
−0
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ae25328
feat(fleet-ide): add Fleet IDE module for JetBrains integration
DevelopmentCats 16fe32b
Merge branch 'main' into cat/fleet-ide
matifali f80a785
docs: update frontmatter display to Jetbrains Fleet
DevelopmentCats c77f231
docs: remove unnecessary explanation
DevelopmentCats 6ae2f1a
docs: add coder cli info
DevelopmentCats a665405
fix: simplify Fleet connection URL by removing unnecessary parameter
DevelopmentCats 02acfd0
docs: move important note about Coder CLI and Desktop requirements fo…
DevelopmentCats fb48bd5
fix: update Fleet connection URL to include workspace and owner param…
DevelopmentCats 5c11d53
chore: update fleet display name
DevelopmentCats 6b2de7b
fix: update Fleet connection URLs to consistently include workspace a…
DevelopmentCats File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
display_name: JetBrains Fleet | ||
description: Add a one-click button to launch JetBrains Fleet IDE to connect to your workspace. | ||
icon: ../../../../.icons/jetbrains.svg | ||
maintainer_github: coder | ||
verified: false | ||
tags: [ide, jetbrains, fleet] | ||
--- | ||
|
||
# Fleet IDE | ||
|
||
This module adds a Fleet IDE button to your Coder workspace that opens the workspace in JetBrains Fleet using SSH remote development. | ||
|
||
JetBrains Fleet is a next-generation IDE that supports collaborative development and distributed architectures. It connects to your Coder workspace via SSH, providing a seamless remote development experience. | ||
|
||
```tf | ||
module "fleet_ide" { | ||
count = data.coder_workspace.me.start_count | ||
source = "registry.coder.com/coder/fleet-ide/coder" | ||
version = "1.0.0" | ||
agent_id = coder_agent.example.id | ||
} | ||
``` | ||
|
||
 | ||
|
||
## Requirements | ||
|
||
- JetBrains Fleet must be installed locally on your development machine | ||
- Download Fleet from: https://www.jetbrains.com/fleet/ | ||
|
||
> [IMPORTANT] | ||
> Fleet needs you to either have Coder CLI installed with `coder config-ssh` run or [Coder Desktop](https://coder.com/docs/user-guides/desktop). | ||
|
||
## Examples | ||
|
||
### Basic usage | ||
|
||
```tf | ||
module "fleet_ide" { | ||
count = data.coder_workspace.me.start_count | ||
source = "registry.coder.com/coder/fleet-ide/coder" | ||
version = "1.0.0" | ||
agent_id = coder_agent.example.id | ||
} | ||
``` | ||
|
||
### Open a specific folder | ||
|
||
```tf | ||
module "fleet_ide" { | ||
count = data.coder_workspace.me.start_count | ||
source = "registry.coder.com/coder/fleet-ide/coder" | ||
version = "1.0.0" | ||
agent_id = coder_agent.example.id | ||
folder = "/home/coder/project" | ||
} | ||
``` | ||
|
||
### Customize app name and grouping | ||
|
||
```tf | ||
module "fleet_ide" { | ||
count = data.coder_workspace.me.start_count | ||
source = "registry.coder.com/coder/fleet-ide/coder" | ||
version = "1.0.0" | ||
agent_id = coder_agent.example.id | ||
display_name = "Fleet" | ||
group = "JetBrains IDEs" | ||
order = 1 | ||
} | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import { describe, expect, it } from "bun:test"; | ||
import { | ||
runTerraformApply, | ||
runTerraformInit, | ||
testRequiredVariables, | ||
} from "~test"; | ||
|
||
describe("fleet-ide", async () => { | ||
await runTerraformInit(import.meta.dir); | ||
|
||
testRequiredVariables(import.meta.dir, { | ||
agent_id: "foo", | ||
}); | ||
|
||
it("default output", async () => { | ||
const state = await runTerraformApply(import.meta.dir, { | ||
agent_id: "foo", | ||
}); | ||
expect(state.outputs.fleet_url.value).toBe( | ||
"fleet://fleet.ssh/https://mydeployment.coder.com?workspace=default&owner=default", | ||
); | ||
|
||
const coder_app = state.resources.find( | ||
(res) => res.type === "coder_app" && res.name === "fleet", | ||
); | ||
|
||
expect(coder_app).not.toBeNull(); | ||
expect(coder_app?.instances.length).toBe(1); | ||
expect(coder_app?.instances[0].attributes.order).toBeNull(); | ||
}); | ||
|
||
it("adds folder", async () => { | ||
const state = await runTerraformApply(import.meta.dir, { | ||
agent_id: "foo", | ||
folder: "/foo/bar", | ||
}); | ||
expect(state.outputs.fleet_url.value).toBe( | ||
"fleet://fleet.ssh/https://mydeployment.coder.com?workspace=default&owner=default&pwd=/foo/bar", | ||
); | ||
}); | ||
|
||
it("custom display name and slug", async () => { | ||
const state = await runTerraformApply(import.meta.dir, { | ||
agent_id: "foo", | ||
display_name: "My Fleet", | ||
slug: "my-fleet", | ||
}); | ||
expect(state.outputs.fleet_url.value).toBe( | ||
"fleet://fleet.ssh/https://mydeployment.coder.com?workspace=default&owner=default", | ||
); | ||
|
||
const coder_app = state.resources.find( | ||
(res) => res.type === "coder_app" && res.name === "fleet", | ||
); | ||
|
||
expect(coder_app).not.toBeNull(); | ||
expect(coder_app?.instances[0].attributes.display_name).toBe("My Fleet"); | ||
expect(coder_app?.instances[0].attributes.slug).toBe("my-fleet"); | ||
}); | ||
|
||
it("expect order to be set", async () => { | ||
const state = await runTerraformApply(import.meta.dir, { | ||
agent_id: "foo", | ||
order: "22", | ||
}); | ||
|
||
const coder_app = state.resources.find( | ||
(res) => res.type === "coder_app" && res.name === "fleet", | ||
); | ||
|
||
expect(coder_app).not.toBeNull(); | ||
expect(coder_app?.instances.length).toBe(1); | ||
expect(coder_app?.instances[0].attributes.order).toBe(22); | ||
}); | ||
|
||
it("expect group to be set", async () => { | ||
const state = await runTerraformApply(import.meta.dir, { | ||
agent_id: "foo", | ||
group: "JetBrains IDEs", | ||
}); | ||
|
||
const coder_app = state.resources.find( | ||
(res) => res.type === "coder_app" && res.name === "fleet", | ||
); | ||
|
||
expect(coder_app).not.toBeNull(); | ||
expect(coder_app?.instances.length).toBe(1); | ||
expect(coder_app?.instances[0].attributes.group).toBe("JetBrains IDEs"); | ||
}); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
terraform { | ||
required_version = ">= 1.0" | ||
|
||
required_providers { | ||
coder = { | ||
source = "coder/coder" | ||
version = ">= 2.5" | ||
} | ||
} | ||
} | ||
|
||
variable "agent_id" { | ||
type = string | ||
description = "The ID of a Coder agent." | ||
} | ||
|
||
variable "folder" { | ||
type = string | ||
description = "The folder to open in Fleet IDE." | ||
default = "" | ||
} | ||
|
||
variable "order" { | ||
type = number | ||
description = "The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order)." | ||
default = null | ||
} | ||
|
||
variable "group" { | ||
type = string | ||
description = "The name of a group that this app belongs to." | ||
default = null | ||
} | ||
|
||
variable "slug" { | ||
type = string | ||
description = "The slug of the app." | ||
default = "fleet" | ||
} | ||
|
||
variable "display_name" { | ||
type = string | ||
description = "The display name of the app." | ||
default = "JetBrains Fleet" | ||
} | ||
|
||
data "coder_workspace" "me" {} | ||
data "coder_workspace_owner" "me" {} | ||
|
||
resource "coder_app" "fleet" { | ||
agent_id = var.agent_id | ||
external = true | ||
icon = "/icon/fleet.svg" | ||
slug = var.slug | ||
display_name = var.display_name | ||
order = var.order | ||
group = var.group | ||
url = join("", [ | ||
"fleet://fleet.ssh/", | ||
data.coder_workspace.me.access_url, | ||
"?workspace=", | ||
data.coder_workspace.me.name, | ||
"&owner=", | ||
data.coder_workspace_owner.me.name, | ||
var.folder != "" ? join("", ["&pwd=", var.folder]) : "" | ||
]) | ||
} | ||
|
||
output "fleet_url" { | ||
value = coder_app.fleet.url | ||
description = "Fleet IDE connection URL." | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we are using the 2.5 version because of the
group
property.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I based this off of the other modules that work the same way but yeah ultmately