diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4d0c709..c5d9c73 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,6 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: coder/coder/.github/actions/setup-tf@main - uses: oven-sh/setup-bun@v2 with: bun-version: latest @@ -29,6 +30,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 # Needed to get tags + - uses: coder/coder/.github/actions/setup-tf@main - uses: oven-sh/setup-bun@v2 with: bun-version: latest diff --git a/jetbrains-gateway/README.md b/jetbrains-gateway/README.md index b2c0e0f..99bc5bd 100644 --- a/jetbrains-gateway/README.md +++ b/jetbrains-gateway/README.md @@ -14,7 +14,7 @@ This module adds a JetBrains Gateway Button to open any workspace with a single ```tf module "jetbrains_gateway" { source = "registry.coder.com/modules/jetbrains-gateway/coder" - version = "1.0.13" + version = "1.0.20" agent_id = coder_agent.example.id agent_name = "example" folder = "/home/coder/example" @@ -32,7 +32,7 @@ module "jetbrains_gateway" { ```tf module "jetbrains_gateway" { source = "registry.coder.com/modules/jetbrains-gateway/coder" - version = "1.0.13" + version = "1.0.20" agent_id = coder_agent.example.id agent_name = "example" folder = "/home/coder/example" @@ -46,7 +46,7 @@ module "jetbrains_gateway" { ```tf module "jetbrains_gateway" { source = "registry.coder.com/modules/jetbrains-gateway/coder" - version = "1.0.13" + version = "1.0.20" agent_id = coder_agent.example.id agent_name = "example" folder = "/home/coder/example" @@ -61,7 +61,7 @@ module "jetbrains_gateway" { ```tf module "jetbrains_gateway" { source = "registry.coder.com/modules/jetbrains-gateway/coder" - version = "1.0.13" + version = "1.0.20" agent_id = coder_agent.example.id agent_name = "example" folder = "/home/coder/example" diff --git a/jetbrains-gateway/main.test.ts b/jetbrains-gateway/main.test.ts index b327e41..0a5b3bc 100644 --- a/jetbrains-gateway/main.test.ts +++ b/jetbrains-gateway/main.test.ts @@ -14,6 +14,26 @@ describe("jetbrains-gateway", async () => { folder: "/home/foo", }); + it("should create a link with the default values", async () => { + const state = await runTerraformApply(import.meta.dir, { + // These are all required. + agent_id: "foo", + agent_name: "foo", + folder: "/home/coder", + }); + expect(state.outputs.url.value).toBe( + "jetbrains-gateway://connect#type=coder&workspace=default&owner=default&agent=foo&folder=/home/coder&url=https://mydeployment.coder.com&token=$SESSION_TOKEN&ide_product_code=IU&ide_build_number=241.14494.240&ide_download_link=https://download.jetbrains.com/idea/ideaIU-2024.1.tar.gz", + ); + + const coder_app = state.resources.find( + (res) => res.type === "coder_app" && res.name === "gateway", + ); + + expect(coder_app).not.toBeNull(); + expect(coder_app?.instances.length).toBe(1); + expect(coder_app?.instances[0].attributes.order).toBeNull(); + }); + it("default to first ide", async () => { const state = await runTerraformApply(import.meta.dir, { agent_id: "foo", diff --git a/jetbrains-gateway/main.tf b/jetbrains-gateway/main.tf index c96098c..d4474b2 100644 --- a/jetbrains-gateway/main.tf +++ b/jetbrains-gateway/main.tf @@ -243,6 +243,7 @@ data "coder_parameter" "jetbrains_ide" { } data "coder_workspace" "me" {} +data "coder_workspace_owner" "me" {} resource "coder_app" "gateway" { agent_id = var.agent_id @@ -254,6 +255,8 @@ resource "coder_app" "gateway" { url = join("", [ "jetbrains-gateway://connect#type=coder&workspace=", data.coder_workspace.me.name, + "&owner=", + data.coder_workspace_owner.me.name, "&agent=", var.agent_name, "&folder=", diff --git a/vault-jwt/README.md b/vault-jwt/README.md index 67aa7e5..939bed2 100644 --- a/vault-jwt/README.md +++ b/vault-jwt/README.md @@ -15,7 +15,7 @@ This module lets you authenticate with [Hashicorp Vault](https://www.vaultprojec ```tf module "vault" { source = "registry.coder.com/modules/vault-jwt/coder" - version = "1.0.19" + version = "1.0.20" agent_id = coder_agent.example.id vault_addr = "https://vault.example.com" vault_jwt_role = "coder" # The Vault role to use for authentication @@ -41,7 +41,7 @@ curl -H "X-Vault-Token: ${VAULT_TOKEN}" -X GET "${VAULT_ADDR}/v1/coder/secrets/d ```tf module "vault" { source = "registry.coder.com/modules/vault-jwt/coder" - version = "1.0.19" + version = "1.0.20" agent_id = coder_agent.example.id vault_addr = "https://vault.example.com" vault_jwt_auth_path = "oidc" @@ -56,7 +56,7 @@ data "coder_workspace_owner" "me" {} module "vault" { source = "registry.coder.com/modules/vault-jwt/coder" - version = "1.0.19" + version = "1.0.20" agent_id = coder_agent.example.id vault_addr = "https://vault.example.com" vault_jwt_role = data.coder_workspace_owner.me.groups[0] @@ -68,7 +68,7 @@ module "vault" { ```tf module "vault" { source = "registry.coder.com/modules/vault-jwt/coder" - version = "1.0.19" + version = "1.0.20" agent_id = coder_agent.example.id vault_addr = "https://vault.example.com" vault_jwt_role = "coder" # The Vault role to use for authentication diff --git a/vault-jwt/run.sh b/vault-jwt/run.sh index 662b378..ef45884 100644 --- a/vault-jwt/run.sh +++ b/vault-jwt/run.sh @@ -51,7 +51,7 @@ install() { printf "Failed to determine the latest Vault version.\n" return 1 fi - VAULT_CLI_VERSION=$${VAULT_CLI_VERSION} + VAULT_CLI_VERSION=$${LATEST_VERSION} fi # Check if the vault CLI is installed and has the correct version diff --git a/vscode-web/README.md b/vscode-web/README.md index ba395d0..821d518 100644 --- a/vscode-web/README.md +++ b/vscode-web/README.md @@ -14,7 +14,7 @@ Automatically install [Visual Studio Code Server](https://code.visualstudio.com/ ```tf module "vscode-web" { source = "registry.coder.com/modules/vscode-web/coder" - version = "1.0.14" + version = "1.0.20" agent_id = coder_agent.example.id accept_license = true } @@ -29,7 +29,7 @@ module "vscode-web" { ```tf module "vscode-web" { source = "registry.coder.com/modules/vscode-web/coder" - version = "1.0.14" + version = "1.0.20" agent_id = coder_agent.example.id install_prefix = "/home/coder/.vscode-web" folder = "/home/coder" @@ -42,7 +42,7 @@ module "vscode-web" { ```tf module "vscode-web" { source = "registry.coder.com/modules/vscode-web/coder" - version = "1.0.14" + version = "1.0.20" agent_id = coder_agent.example.id extensions = ["github.copilot", "ms-python.python", "ms-toolsai.jupyter"] accept_license = true @@ -56,7 +56,7 @@ Configure VS Code's [settings.json](https://code.visualstudio.com/docs/getstarte ```tf module "vscode-web" { source = "registry.coder.com/modules/vscode-web/coder" - version = "1.0.14" + version = "1.0.20" agent_id = coder_agent.example.id extensions = ["dracula-theme.theme-dracula"] settings = { diff --git a/vscode-web/run.sh b/vscode-web/run.sh index ce8782f..ecfad68 100755 --- a/vscode-web/run.sh +++ b/vscode-web/run.sh @@ -72,27 +72,25 @@ for extension in "$${EXTENSIONLIST[@]}"; do output=$($VSCODE_WEB "$EXTENSION_ARG" --install-extension "$extension" --force) if [ $? -ne 0 ]; then echo "Failed to install extension: $extension: $output" - exit 1 fi done 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 + else + WORKSPACE_DIR="$HOME" + if [ -n "${FOLDER}" ]; then + WORKSPACE_DIR="${FOLDER}" + fi - 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 - $VSCODE_WEB "$EXTENSION_ARG" --install-extension "$extension" --force - 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 + $VSCODE_WEB "$EXTENSION_ARG" --install-extension "$extension" --force + done + fi fi fi