Skip to content

Commit

Permalink
feat(cli): print ingress endpoints after deploying
Browse files Browse the repository at this point in the history
Closes #502
  • Loading branch information
edvald committed Mar 1, 2019
1 parent 913cb4f commit b7961ec
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions garden-service/src/tasks/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import chalk from "chalk"
import { includes } from "lodash"
import { LogEntry } from "../logger/log-entry"
import { BaseTask } from "./base"
import { Service, ServiceStatus, getServiceRuntimeContext } from "../types/service"
import { Service, ServiceStatus, getServiceRuntimeContext, getIngressUrl } from "../types/service"
import { Garden } from "../garden"
import { PushTask } from "./push"
import { TaskTask } from "./task"
Expand Down Expand Up @@ -117,7 +117,7 @@ export class DeployTask extends BaseTask {

const runtimeContext = await getServiceRuntimeContext(this.garden, this.graph, this.service)

const status = await this.garden.actions.getServiceStatus({
let status = await this.garden.actions.getServiceStatus({
service: this.service,
log,
hotReload,
Expand All @@ -136,26 +136,29 @@ export class DeployTask extends BaseTask {
msg: `Version ${versionString} already deployed`,
append: true,
})
return status
}
} else {
log.setState(`Deploying version ${versionString}...`)

try {
status = await this.garden.actions.deployService({
service: this.service,
runtimeContext,
log,
force: this.force,
hotReload,
})
} catch (err) {
log.setError()
throw err
}

log.setState(`Deploying version ${versionString}...`)
log.setSuccess({ msg: chalk.green(`Done (took ${log.getDuration(1)} sec)`), append: true })
}

let result: ServiceStatus
try {
result = await this.garden.actions.deployService({
service: this.service,
runtimeContext,
log,
force: this.force,
hotReload,
})
} catch (err) {
log.setError()
throw err
for (const ingress of status.ingresses || []) {
log.info(chalk.gray("→ Ingress: ") + chalk.underline.gray(getIngressUrl(ingress)))
}

log.setSuccess({ msg: chalk.green(`Done (took ${log.getDuration(1)} sec)`), append: true })
return result
return status
}
}

0 comments on commit b7961ec

Please sign in to comment.