|
7 | 7 | getWorkspaceByOwnerAndName, |
8 | 8 | startWorkspace, |
9 | 9 | getDeploymentSSHConfig, |
| 10 | + getTemplateVersion, |
10 | 11 | } from "coder/site/src/api/api" |
11 | 12 | import { ProvisionerJobLog, Workspace, WorkspaceAgent } from "coder/site/src/api/typesGenerated" |
12 | 13 | import EventSource from "eventsource" |
@@ -303,12 +304,20 @@ export class Remote { |
303 | 304 | if (newWorkspace.outdated) { |
304 | 305 | if (!this.storage.workspace?.outdated || !hasShownOutdatedNotification) { |
305 | 306 | hasShownOutdatedNotification = true |
306 | | - vscode.window |
307 | | - .showInformationMessage("A new version of your workspace is available.", "Update") |
308 | | - .then((action) => { |
309 | | - if (action === "Update") { |
310 | | - vscode.commands.executeCommand("coder.workspace.update", newWorkspace) |
| 307 | + getTemplate(newWorkspace.template_id) |
| 308 | + .then((template) => { |
| 309 | + return getTemplateVersion(template.active_version_id) |
| 310 | + }) |
| 311 | + .then((version) => { |
| 312 | + let infoMessage = `A new version of your workspace is available.` |
| 313 | + if (version.message) { |
| 314 | + infoMessage = `A new version of your workspace is available: ${version.message}` |
311 | 315 | } |
| 316 | + vscode.window.showInformationMessage(infoMessage, "Update").then((action) => { |
| 317 | + if (action === "Update") { |
| 318 | + vscode.commands.executeCommand("coder.workspace.update", newWorkspace) |
| 319 | + } |
| 320 | + }) |
312 | 321 | }) |
313 | 322 | } |
314 | 323 | } |
@@ -507,7 +516,14 @@ export class Remote { |
507 | 516 | if (this.mode === vscode.ExtensionMode.Production) { |
508 | 517 | binaryPath = await this.storage.fetchBinary() |
509 | 518 | } else { |
510 | | - binaryPath = path.join(os.tmpdir(), "coder") |
| 519 | + try { |
| 520 | + // In development, try to use `/tmp/coder` as the binary path. |
| 521 | + // This is useful for debugging with a custom bin! |
| 522 | + binaryPath = path.join(os.tmpdir(), "coder") |
| 523 | + await fs.stat(binaryPath) |
| 524 | + } catch (ex) { |
| 525 | + binaryPath = await this.storage.fetchBinary() |
| 526 | + } |
511 | 527 | } |
512 | 528 | if (!binaryPath) { |
513 | 529 | throw new Error("Failed to fetch the Coder binary!") |
|
0 commit comments