diff --git a/core/src/commands/base.ts b/core/src/commands/base.ts index 4db02a7dad..9e217019b9 100644 --- a/core/src/commands/base.ts +++ b/core/src/commands/base.ts @@ -59,10 +59,6 @@ export interface PrepareParams extends PrepareParams { garden: Garden - /** - * Only use when running a workflow step command (in which case `true` should be passed). - */ - isWorkflowStepCommand?: boolean } interface PrepareOutput { diff --git a/core/src/commands/build.ts b/core/src/commands/build.ts index 904d76501d..6d34a604da 100644 --- a/core/src/commands/build.ts +++ b/core/src/commands/build.ts @@ -90,7 +90,6 @@ export class BuildCommand extends Command { async action({ garden, - isWorkflowStepCommand, log, footerLog, args, @@ -104,7 +103,7 @@ export class BuildCommand extends Command { await garden.clearBuilds() - const graph = await garden.getConfigGraph({ log, emit: !isWorkflowStepCommand }) + const graph = await garden.getConfigGraph({ log, emit: true }) const modules = graph.getModules({ names: args.modules }) const moduleNames = modules.map((m) => m.name) diff --git a/core/src/commands/call.ts b/core/src/commands/call.ts index c8b0741c63..caf2b5db6a 100644 --- a/core/src/commands/call.ts +++ b/core/src/commands/call.ts @@ -66,11 +66,11 @@ export class CallCommand extends Command { printHeader(headerLog, "Call", "telephone_receiver") } - async action({ garden, isWorkflowStepCommand, log, args }: CommandParams): Promise> { + async action({ garden, log, args }: CommandParams): Promise> { let [serviceName, path] = splitFirst(args.serviceAndPath, "/") // TODO: better error when service doesn't exist - const graph = await garden.getConfigGraph({ log, emit: !isWorkflowStepCommand }) + const graph = await garden.getConfigGraph({ log, emit: true }) const service = graph.getService(serviceName) // No need for full context, since we're just checking if the service is running. const runtimeContext = emptyRuntimeContext diff --git a/core/src/commands/delete.ts b/core/src/commands/delete.ts index a48a39cf82..009c04971f 100644 --- a/core/src/commands/delete.ts +++ b/core/src/commands/delete.ts @@ -110,10 +110,10 @@ export class DeleteEnvironmentCommand extends Command { printHeader(headerLog, `Deleting environment`, "skull_and_crossbones") } - async action({ garden, isWorkflowStepCommand, log }: CommandParams): Promise> { + async action({ garden, log }: CommandParams): Promise> { const actions = await garden.getActionRouter() - const graph = await garden.getConfigGraph({ log, emit: !isWorkflowStepCommand }) + const graph = await garden.getConfigGraph({ log, emit: true }) const serviceStatuses = await actions.deleteServices(graph, log) log.info("") @@ -159,8 +159,8 @@ export class DeleteServiceCommand extends Command { printHeader(headerLog, "Delete service", "skull_and_crossbones") } - async action({ garden, isWorkflowStepCommand, log, args }: CommandParams): Promise { - const graph = await garden.getConfigGraph({ log, emit: !isWorkflowStepCommand }) + async action({ garden, log, args }: CommandParams): Promise { + const graph = await garden.getConfigGraph({ log, emit: true }) const services = graph.getServices({ names: args.services }) if (services.length === 0) { diff --git a/core/src/commands/deploy.ts b/core/src/commands/deploy.ts index bdc8823c29..a2a3d17596 100644 --- a/core/src/commands/deploy.ts +++ b/core/src/commands/deploy.ts @@ -137,7 +137,6 @@ export class DeployCommand extends Command { async action({ garden, - isWorkflowStepCommand, log, footerLog, args, @@ -149,7 +148,7 @@ export class DeployCommand extends Command { this.server.setGarden(garden) } - const initGraph = await garden.getConfigGraph({ log, emit: !isWorkflowStepCommand }) + const initGraph = await garden.getConfigGraph({ log, emit: true }) let services = initGraph.getServices({ names: args.services, includeDisabled: true }) const disabled = services.filter((s) => s.disabled).map((s) => s.name) diff --git a/core/src/commands/dev.ts b/core/src/commands/dev.ts index 3706269df3..3e100584b5 100644 --- a/core/src/commands/dev.ts +++ b/core/src/commands/dev.ts @@ -119,7 +119,6 @@ export class DevCommand extends Command { async action({ garden, - isWorkflowStepCommand, log, footerLog, args, @@ -128,7 +127,7 @@ export class DevCommand extends Command { this.garden = garden this.server?.setGarden(garden) - const graph = await garden.getConfigGraph({ log, emit: !isWorkflowStepCommand }) + const graph = await garden.getConfigGraph({ log, emit: true }) const modules = graph.getModules() const skipTests = opts["skip-tests"] diff --git a/core/src/commands/get/get-status.ts b/core/src/commands/get/get-status.ts index 03ac5224e4..47268376c4 100644 --- a/core/src/commands/get/get-status.ts +++ b/core/src/commands/get/get-status.ts @@ -66,14 +66,9 @@ export class GetStatusCommand extends Command { printHeader(headerLog, "Get status", "pager") } - async action({ - garden, - isWorkflowStepCommand, - log, - opts, - }: CommandParams): Promise> { + async action({ garden, log, opts }: CommandParams): Promise> { const actions = await garden.getActionRouter() - const graph = await garden.getConfigGraph({ log, emit: !isWorkflowStepCommand }) + const graph = await garden.getConfigGraph({ log, emit: true }) const envStatus = await garden.getEnvironmentStatus(log) const serviceStatuses = await actions.getServiceStatuses({ log, graph }) diff --git a/core/src/commands/get/get-task-result.ts b/core/src/commands/get/get-task-result.ts index b9aefc85c0..bdc41fcfcd 100644 --- a/core/src/commands/get/get-task-result.ts +++ b/core/src/commands/get/get-task-result.ts @@ -52,15 +52,10 @@ export class GetTaskResultCommand extends Command { printHeader(headerLog, `Task result for task ${chalk.cyan(taskName)}`, "rocket") } - async action({ - garden, - isWorkflowStepCommand, - log, - args, - }: CommandParams): Promise> { + async action({ garden, log, args }: CommandParams): Promise> { const taskName = args.name - const graph: ConfigGraph = await garden.getConfigGraph({ log, emit: !isWorkflowStepCommand }) + const graph: ConfigGraph = await garden.getConfigGraph({ log, emit: true }) const task = graph.getTask(taskName) const actions = await garden.getActionRouter() diff --git a/core/src/commands/get/get-test-result.ts b/core/src/commands/get/get-test-result.ts index 8c3040f959..0ec27910fd 100644 --- a/core/src/commands/get/get-test-result.ts +++ b/core/src/commands/get/get-test-result.ts @@ -61,16 +61,11 @@ export class GetTestResultCommand extends Command { ) } - async action({ - garden, - isWorkflowStepCommand, - log, - args, - }: CommandParams): Promise> { + async action({ garden, log, args }: CommandParams): Promise> { const testName = args.name const moduleName = args.module - const graph = await garden.getConfigGraph({ log, emit: !isWorkflowStepCommand }) + const graph = await garden.getConfigGraph({ log, emit: true }) const actions = await garden.getActionRouter() const module = graph.getModule(moduleName) diff --git a/core/src/commands/publish.ts b/core/src/commands/publish.ts index e5172386d5..f658471c96 100644 --- a/core/src/commands/publish.ts +++ b/core/src/commands/publish.ts @@ -103,13 +103,12 @@ export class PublishCommand extends Command { async action({ garden, - isWorkflowStepCommand, log, footerLog, args, opts, }: CommandParams): Promise> { - const graph = await garden.getConfigGraph({ log, emit: !isWorkflowStepCommand }) + const graph = await garden.getConfigGraph({ log, emit: true }) const modules = graph.getModules({ names: args.modules }) const results = await publishModules({ diff --git a/core/src/commands/run/task.ts b/core/src/commands/run/task.ts index 3c4fa631c8..9e105647dc 100644 --- a/core/src/commands/run/task.ts +++ b/core/src/commands/run/task.ts @@ -80,14 +80,8 @@ export class RunTaskCommand extends Command { printHeader(headerLog, msg, "runner") } - async action({ - garden, - isWorkflowStepCommand, - log, - args, - opts, - }: CommandParams): Promise> { - const graph = await garden.getConfigGraph({ log, emit: !isWorkflowStepCommand }) + async action({ garden, log, args, opts }: CommandParams): Promise> { + const graph = await garden.getConfigGraph({ log, emit: true }) const task = graph.getTask(args.task, true) if (task.disabled && !opts.force) { diff --git a/core/src/commands/run/test.ts b/core/src/commands/run/test.ts index f9905e8b2f..090d2502a4 100644 --- a/core/src/commands/run/test.ts +++ b/core/src/commands/run/test.ts @@ -93,17 +93,11 @@ export class RunTestCommand extends Command { printHeader(headerLog, `Running test ${chalk.cyan(args.test)}`, "runner") } - async action({ - garden, - isWorkflowStepCommand, - log, - args, - opts, - }: CommandParams): Promise> { + async action({ garden, log, args, opts }: CommandParams): Promise> { const moduleName = args.module const testName = args.test - const graph = await garden.getConfigGraph({ log, emit: !isWorkflowStepCommand }) + const graph = await garden.getConfigGraph({ log, emit: true }) const module = graph.getModule(moduleName, true) const testConfig = findByName(module.testConfigs, testName) diff --git a/core/src/commands/run/workflow.ts b/core/src/commands/run/workflow.ts index 35e6221a2a..b83c86b07e 100644 --- a/core/src/commands/run/workflow.ts +++ b/core/src/commands/run/workflow.ts @@ -89,7 +89,6 @@ export class RunWorkflowCommand extends Command { const steps = workflow.steps const allStepNames = steps.map((s, i) => getStepName(i, s.name)) const startedAt = new Date().valueOf() - await maybeEmitStackGraphEvent(garden, log, workflow) const result: WorkflowRunOutput = { steps: {}, @@ -331,7 +330,6 @@ export async function runStepCommand({ headerLog, args, opts: merge(inheritedOpts, opts), - isWorkflowStepCommand: true, // <----- }) return result } @@ -455,27 +453,6 @@ async function registerAndSetUid(garden: Garden, log: LogEntry, config: Workflow } } -/** - * If one or more steps of the workflow is a command with `streamEvents = true`, we prepare a `ConfigGraph` instance - * and stream a stack graph event. - * - * This is only done once at the beginning of the workflow to avoid streaming the graph for every subcommand having - * `streamEvents = true` (since we're also passing `isStepCommand = true` to the step command action in - * `runStepCommand`). - */ -async function maybeEmitStackGraphEvent(garden: Garden, log: LogEntry, config: WorkflowConfig) { - const shouldEmitStackGraphEvent = config.steps.find((s) => { - if (!s.command) { - return false - } - const { command } = pickCommand(getAllCommands(), s.command) - return command && command.streamEvents - }) - if (shouldEmitStackGraphEvent) { - await garden.getConfigGraph({ log, emit: true }) - } -} - async function writeWorkflowFile(garden: Garden, file: WorkflowFileSpec) { let data: string diff --git a/core/src/commands/test.ts b/core/src/commands/test.ts index 9b4f4751c1..889f4d3b01 100644 --- a/core/src/commands/test.ts +++ b/core/src/commands/test.ts @@ -119,7 +119,6 @@ export class TestCommand extends Command { async action({ garden, - isWorkflowStepCommand, log, footerLog, args, @@ -131,7 +130,7 @@ export class TestCommand extends Command { this.server.setGarden(garden) } - const graph = await garden.getConfigGraph({ log, emit: !isWorkflowStepCommand }) + const graph = await garden.getConfigGraph({ log, emit: true }) const skipDependants = opts["skip-dependants"] let modules: GardenModule[]