diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c5d9c73d..2de2364c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,14 +16,23 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: coder/coder/.github/actions/setup-tf@main - - uses: oven-sh/setup-bun@v2 + - name: Check out code + uses: actions/checkout@v4 + - name: Set up Terraform + uses: coder/coder/.github/actions/setup-tf@main + - name: Set up Bun + uses: oven-sh/setup-bun@v2 with: + # We're using the latest version of Bun for now, but it might be worth + # reconsidering. They've pushed breaking changes in patch releases + # that have broken our CI. + # Our PR where issues started to pop up: https://github.com/coder/modules/pull/383 + # The Bun PR that broke things: https://github.com/oven-sh/bun/pull/16067 bun-version: latest - - name: Setup + - name: Install dependencies run: bun install - - run: bun test + - name: Run tests + run: bun test pretty: runs-on: ubuntu-latest steps: diff --git a/jetbrains-gateway/README.md b/jetbrains-gateway/README.md index 0d967a99..a3269a4c 100644 --- a/jetbrains-gateway/README.md +++ b/jetbrains-gateway/README.md @@ -15,9 +15,8 @@ This module adds a JetBrains Gateway Button to open any workspace with a single module "jetbrains_gateway" { count = data.coder_workspace.me.start_count source = "registry.coder.com/modules/jetbrains-gateway/coder" - version = "1.0.27" + version = "1.0.28" agent_id = coder_agent.example.id - agent_name = "example" folder = "/home/coder/example" jetbrains_ides = ["CL", "GO", "IU", "PY", "WS"] default = "GO" @@ -34,9 +33,8 @@ module "jetbrains_gateway" { module "jetbrains_gateway" { count = data.coder_workspace.me.start_count source = "registry.coder.com/modules/jetbrains-gateway/coder" - version = "1.0.27" + version = "1.0.28" agent_id = coder_agent.example.id - agent_name = "example" folder = "/home/coder/example" jetbrains_ides = ["GO", "WS"] default = "GO" @@ -49,9 +47,8 @@ module "jetbrains_gateway" { module "jetbrains_gateway" { count = data.coder_workspace.me.start_count source = "registry.coder.com/modules/jetbrains-gateway/coder" - version = "1.0.27" + version = "1.0.28" agent_id = coder_agent.example.id - agent_name = "example" folder = "/home/coder/example" jetbrains_ides = ["IU", "PY"] default = "IU" @@ -65,9 +62,8 @@ module "jetbrains_gateway" { module "jetbrains_gateway" { count = data.coder_workspace.me.start_count source = "registry.coder.com/modules/jetbrains-gateway/coder" - version = "1.0.27" + version = "1.0.28" agent_id = coder_agent.example.id - agent_name = "example" folder = "/home/coder/example" jetbrains_ides = ["IU", "PY"] default = "IU" @@ -91,9 +87,8 @@ module "jetbrains_gateway" { module "jetbrains_gateway" { count = data.coder_workspace.me.start_count source = "registry.coder.com/modules/jetbrains-gateway/coder" - version = "1.0.27" + version = "1.0.28" agent_id = coder_agent.example.id - agent_name = "example" folder = "/home/coder/example" jetbrains_ides = ["GO", "WS"] default = "GO" @@ -110,9 +105,8 @@ Due to the highest priority of the `ide_download_link` parameter in the `(jetbra module "jetbrains_gateway" { count = data.coder_workspace.me.start_count source = "registry.coder.com/modules/jetbrains-gateway/coder" - version = "1.0.27" + version = "1.0.28" agent_id = coder_agent.example.id - agent_name = "example" folder = "/home/coder/example" jetbrains_ides = ["GO", "WS"] releases_base_link = "https://releases.internal.site/" diff --git a/jetbrains-gateway/main.test.ts b/jetbrains-gateway/main.test.ts index a532e9bd..ea04a77d 100644 --- a/jetbrains-gateway/main.test.ts +++ b/jetbrains-gateway/main.test.ts @@ -10,7 +10,6 @@ describe("jetbrains-gateway", async () => { await testRequiredVariables(import.meta.dir, { agent_id: "foo", - agent_name: "foo", folder: "/home/foo", }); @@ -18,11 +17,10 @@ describe("jetbrains-gateway", 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=243.21565.193&ide_download_link=https://download.jetbrains.com/idea/ideaIU-2024.3.tar.gz", + "jetbrains-gateway://connect#type=coder&workspace=default&owner=default&folder=/home/coder&url=https://mydeployment.coder.com&token=$SESSION_TOKEN&ide_product_code=IU&ide_build_number=243.21565.193&ide_download_link=https://download.jetbrains.com/idea/ideaIU-2024.3.tar.gz", ); const coder_app = state.resources.find( @@ -37,7 +35,6 @@ describe("jetbrains-gateway", async () => { it("default to first ide", async () => { const state = await runTerraformApply(import.meta.dir, { agent_id: "foo", - agent_name: "foo", folder: "/home/foo", jetbrains_ides: '["IU", "GO", "PY"]', }); diff --git a/jetbrains-gateway/main.tf b/jetbrains-gateway/main.tf index 6daf48b9..d197399d 100644 --- a/jetbrains-gateway/main.tf +++ b/jetbrains-gateway/main.tf @@ -26,7 +26,9 @@ variable "slug" { variable "agent_name" { type = string - description = "Agent name." + description = "Agent name. (unused). Will be removed in a future version" + + default = "" } variable "folder" { @@ -295,8 +297,6 @@ resource "coder_app" "gateway" { data.coder_workspace.me.name, "&owner=", data.coder_workspace_owner.me.name, - "&agent=", - var.agent_name, "&folder=", var.folder, "&url=", diff --git a/setup.ts b/setup.ts index 3cfb871e..a867c758 100644 --- a/setup.ts +++ b/setup.ts @@ -25,7 +25,7 @@ const removeOldContainers = async () => { "-a", "-q", "--filter", - `label=modules-test`, + "label=modules-test", ]); let containerIDsRaw = await readableStreamToText(proc.stdout); let exitCode = await proc.exited; diff --git a/test.ts b/test.ts index 5437374f..0c48ee99 100644 --- a/test.ts +++ b/test.ts @@ -194,13 +194,18 @@ export const testRequiredVariables = ( export const runTerraformApply = async ( dir: string, vars: Readonly, - env?: Record, + customEnv?: Record, ): Promise => { const stateFile = `${dir}/${crypto.randomUUID()}.tfstate`; - const combinedEnv = env === undefined ? {} : { ...env }; - for (const [key, value] of Object.entries(vars)) { - combinedEnv[`TF_VAR_${key}`] = String(value); + const childEnv: Record = { + ...process.env, + ...(customEnv ?? {}), + }; + for (const [key, value] of Object.entries(vars) as [string, JsonValue][]) { + if (value !== null) { + childEnv[`TF_VAR_${key}`] = String(value); + } } const proc = spawn( @@ -216,7 +221,7 @@ export const runTerraformApply = async ( ], { cwd: dir, - env: combinedEnv, + env: childEnv, stderr: "pipe", stdout: "pipe", }, diff --git a/vault-jwt/README.md b/vault-jwt/README.md index 32dc5ccf..66070397 100644 --- a/vault-jwt/README.md +++ b/vault-jwt/README.md @@ -10,7 +10,7 @@ tags: [helper, integration, vault, jwt, oidc] # Hashicorp Vault Integration (JWT) -This module lets you authenticate with [Hashicorp Vault](https://www.vaultproject.io/) in your Coder workspaces by reusing the [OIDC](https://coder.com/docs/admin/auth#openid-connect) access token from Coder's OIDC authentication method. This requires configuring the Vault [JWT/OIDC](https://developer.hashicorp.com/vault/docs/auth/jwt#configuration) auth method. +This module lets you authenticate with [Hashicorp Vault](https://www.vaultproject.io/) in your Coder workspaces by reusing the [OIDC](https://coder.com/docs/admin/users/oidc-auth) access token from Coder's OIDC authentication method. This requires configuring the Vault [JWT/OIDC](https://developer.hashicorp.com/vault/docs/auth/jwt#configuration) auth method. ```tf module "vault" {