Skip to content

Commit

Permalink
fix(cli): detect missing services in --hot option
Browse files Browse the repository at this point in the history
Before, the deploy and dev commands didn't validate that the service
names passed to the --hot/--hot-reload option referred to existing
services.

Also moved some config-level validation in the dev command before the
prepareEnvironment call for faster feedback on config errors.
  • Loading branch information
thsig committed Apr 18, 2019
1 parent 1b5bef6 commit 9209ac4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 8 additions & 1 deletion garden-service/src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,14 @@ export class DeployCommand extends Command<Args, Opts> {
}

const hotReloadServiceNames = opts["hot-reload"] || []
const watch = opts.watch || hotReloadServiceNames.length > 0

let watch
if (hotReloadServiceNames.length > 0) {
await initGraph.getServices(hotReloadServiceNames) // validate the existence of these services
watch = true
} else {
watch = opts.watch
}

// TODO: make this a task
await garden.actions.prepareEnvironment({ log })
Expand Down
7 changes: 5 additions & 2 deletions garden-service/src/commands/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ export class DevCommand extends Command<Args, Opts> {
}

async action({ garden, log, logFooter, opts }: CommandParams<Args, Opts>): Promise<CommandResult> {
await garden.actions.prepareEnvironment({ log })

const graph = await garden.getConfigGraph()
const modules = await graph.getModules()

Expand All @@ -91,6 +89,11 @@ export class DevCommand extends Command<Args, Opts> {
}

const hotReloadServiceNames = opts["hot-reload"] || []
if (hotReloadServiceNames.length > 0) {
await graph.getServices(hotReloadServiceNames) // validate the existence of these services
}

await garden.actions.prepareEnvironment({ log })

const tasksForModule = (watch: boolean) => {
return async (updatedGraph: ConfigGraph, module: Module) => {
Expand Down

0 comments on commit 9209ac4

Please sign in to comment.