diff --git a/scripts/scenarios/start-app.ts b/scripts/scenarios/start-app.ts index 63f9cb9ddd..0397a0903d 100644 --- a/scripts/scenarios/start-app.ts +++ b/scripts/scenarios/start-app.ts @@ -17,7 +17,7 @@ import * as Stream from "effect/Stream"; import { Argument, Command } from "effect/cli"; import { ChildProcess, ChildProcessSpawner } from "effect/process"; -import { ScenarioError } from "./shell.ts"; +import { run, ScenarioError } from "./shell.ts"; // The dev runner's web port is 5733 plus an offset. Mirror of BASE_WEB_PORT in dev-runner.ts. const BASE_WEB_PORT = 5733; @@ -63,12 +63,20 @@ export const prepareHome = Effect.fn("startApp.prepareHome")(function* (home: st yield* fs.writeFileString(shim, HOST_LABEL_SHIM); yield* fs.chmod(shim, 0o755); } + const hostEnv = yield* HostProcess.Environment; + if (hostEnv.T3_SCENARIO_CONNECT_AUTH_HOME) { + const secrets = path.join(home, "userdata/secrets"); + yield* fs.makeDirectory(secrets, { recursive: true }); + yield* fs.copyFile(path.join(hostEnv.T3_SCENARIO_CONNECT_AUTH_HOME, "userdata/secrets/cloud-cli-oauth-token.bin"), path.join(secrets, "cloud-cli-oauth-token.bin")); + yield* fs.writeFileString(path.join(secrets, "cloud-cli-desired-link.bin"), "managed"); + } const noModel = path.join(home, "bin/no-model"); yield* fs.writeFileString(noModel, "#!/bin/sh\necho 'scenarios run no model' >&2\nexit 1\n"); yield* fs.chmod(noModel, 0o755); yield* fs.writeFileString( path.join(home, "userdata/settings.json"), yield* encodeSettings({ + guestSharingEnabled: true, defaultModelSelection: REPLAY, providerInstances: Object.fromEntries( REAL_PROVIDERS.map((driver) => [ @@ -141,6 +149,9 @@ const startApp = Effect.fn("startApp")(function* (input: { ]; if (input.surface === "web") { + if (hostEnvironment.T3_SCENARIO_CONNECT_AUTH_HOME) { + yield* run("vp", ["run", "build"], { cwd: path.join(checkout, "apps/web"), env, echo: true }); + } // e2e opens the app at this host, so the web server is told to bind exactly it. Left to its // default, `localhost`, it binds ::1 alone on machines that resolve the name to IPv6 first. const [host = "", webPort = ""] = input.ports;