feat: goose: add support for subdomain=false (#299)
Updates https://github.com/coder/coder/issues/18779 Builds on https://github.com/coder/registry/pull/297 ## Description Adds support for specifying `subdomain = false` in the agentapi module. Change added in https://github.com/coder/registry/pull/297 NOTE: `AGENTAPI_CHAT_BASE_PATH` is exported before running `main.sh` in agentapi, so this environment variable is available to calling modules if `var.subdomain = false`. ## Type of Change - [ ] New module - [ ] Bug fix - [X] Feature/enhancement - [ ] Documentation - [ ] Other ## Testing & Validation - [X] Tests pass (`bun test`) - [X] Code formatted (`bun run fmt`) - [X] Changes tested locally ## Related Issues https://github.com/coder/coder/issues/18779
This commit is contained in:
parent
03333991a4
commit
74c8698566
@ -13,7 +13,7 @@ Run the [Goose](https://block.github.io/goose/) agent in your workspace to gener
|
|||||||
```tf
|
```tf
|
||||||
module "goose" {
|
module "goose" {
|
||||||
source = "registry.coder.com/coder/goose/coder"
|
source = "registry.coder.com/coder/goose/coder"
|
||||||
version = "2.0.1"
|
version = "2.1.0"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
folder = "/home/coder"
|
folder = "/home/coder"
|
||||||
install_goose = true
|
install_goose = true
|
||||||
@ -79,7 +79,7 @@ resource "coder_agent" "main" {
|
|||||||
module "goose" {
|
module "goose" {
|
||||||
count = data.coder_workspace.me.start_count
|
count = data.coder_workspace.me.start_count
|
||||||
source = "registry.coder.com/coder/goose/coder"
|
source = "registry.coder.com/coder/goose/coder"
|
||||||
version = "2.0.1"
|
version = "2.1.0"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
folder = "/home/coder"
|
folder = "/home/coder"
|
||||||
install_goose = true
|
install_goose = true
|
||||||
|
|||||||
@ -251,4 +251,21 @@ describe("goose", async () => {
|
|||||||
expect(prompt.exitCode).not.toBe(0);
|
expect(prompt.exitCode).not.toBe(0);
|
||||||
expect(prompt.stderr).toContain("No such file or directory");
|
expect(prompt.stderr).toContain("No such file or directory");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("subdomain-false", async () => {
|
||||||
|
const { id } = await setup({
|
||||||
|
agentapiMockScript: await loadTestFile(
|
||||||
|
import.meta.dir,
|
||||||
|
"agentapi-mock-print-args.js",
|
||||||
|
),
|
||||||
|
moduleVariables: {
|
||||||
|
subdomain: "false",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
await execModuleScript(id);
|
||||||
|
|
||||||
|
const agentapiMockOutput = await readFileContainer(id, agentapiStartLog);
|
||||||
|
expect(agentapiMockOutput).toContain("AGENTAPI_CHAT_BASE_PATH=/@default/default.foo/apps/goose/chat");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -63,7 +63,13 @@ variable "install_agentapi" {
|
|||||||
variable "agentapi_version" {
|
variable "agentapi_version" {
|
||||||
type = string
|
type = string
|
||||||
description = "The version of AgentAPI to install."
|
description = "The version of AgentAPI to install."
|
||||||
default = "v0.2.3"
|
default = "v0.3.3"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "subdomain" {
|
||||||
|
type = bool
|
||||||
|
description = "Whether to use a subdomain for AgentAPI."
|
||||||
|
default = true
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "goose_provider" {
|
variable "goose_provider" {
|
||||||
@ -133,7 +139,7 @@ EOT
|
|||||||
|
|
||||||
module "agentapi" {
|
module "agentapi" {
|
||||||
source = "registry.coder.com/coder/agentapi/coder"
|
source = "registry.coder.com/coder/agentapi/coder"
|
||||||
version = "1.0.0"
|
version = "1.1.0"
|
||||||
|
|
||||||
agent_id = var.agent_id
|
agent_id = var.agent_id
|
||||||
web_app_slug = local.app_slug
|
web_app_slug = local.app_slug
|
||||||
@ -146,6 +152,7 @@ module "agentapi" {
|
|||||||
module_dir_name = local.module_dir_name
|
module_dir_name = local.module_dir_name
|
||||||
install_agentapi = var.install_agentapi
|
install_agentapi = var.install_agentapi
|
||||||
agentapi_version = var.agentapi_version
|
agentapi_version = var.agentapi_version
|
||||||
|
agentapi_subdomain = var.subdomain
|
||||||
pre_install_script = var.pre_install_script
|
pre_install_script = var.pre_install_script
|
||||||
post_install_script = var.post_install_script
|
post_install_script = var.post_install_script
|
||||||
start_script = local.start_script
|
start_script = local.start_script
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
const http = require("http");
|
const http = require("http");
|
||||||
const args = process.argv.slice(2);
|
const args = process.argv.slice(2);
|
||||||
console.log(args);
|
console.log(args);
|
||||||
|
console.log(`AGENTAPI_CHAT_BASE_PATH=${process.env["AGENTAPI_CHAT_BASE_PATH"]}`);
|
||||||
const port = 3284;
|
const port = 3284;
|
||||||
|
|
||||||
console.log(`starting server on port ${port}`);
|
console.log(`starting server on port ${port}`);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user