diff --git a/garden-service/src/actions.ts b/garden-service/src/actions.ts index a5a7fae035..d36c3dbcf9 100644 --- a/garden-service/src/actions.ts +++ b/garden-service/src/actions.ts @@ -104,13 +104,13 @@ export interface DeployServicesParams { } /** - * The ActionHelper takes care of choosing which plugin should be responsible for handling an action, + * The ActionRouter takes care of choosing which plugin should be responsible for handling an action, * and preparing common parameters (so as to reduce boilerplate on the usage side). * * Each plugin and module action has a corresponding method on this class (aside from configureProvider, which * is handled especially elsewhere). */ -export class ActionHelper implements TypeGuard { +export class ActionRouter implements TypeGuard { private readonly actionHandlers: WrappedPluginActionMap private readonly moduleActionHandlers: WrappedModuleActionMap private readonly loadedPlugins: PluginMap @@ -124,7 +124,7 @@ export class ActionHelper implements TypeGuard { this.moduleActionHandlers = fromPairs(moduleActionNames.map(n => [n, {}])) this.loadedPlugins = keyBy(loadedPlugins, "name") - garden.log.silly(`Creating ActionHelper with ${configuredPlugins.length} configured plugins`) + garden.log.silly(`Creating ActionRouter with ${configuredPlugins.length} configured plugins`) for (const plugin of configuredPlugins) { const handlers = plugin.handlers || {} @@ -180,7 +180,7 @@ export class ActionHelper implements TypeGuard { } async getEnvironmentStatus( - params: RequirePluginName>, + params: RequirePluginName>, ): Promise { const { pluginName } = params @@ -193,7 +193,7 @@ export class ActionHelper implements TypeGuard { } async prepareEnvironment( - params: RequirePluginName>, + params: RequirePluginName>, ): Promise { const { pluginName } = params @@ -206,7 +206,7 @@ export class ActionHelper implements TypeGuard { } async cleanupEnvironment( - params: RequirePluginName>, + params: RequirePluginName>, ) { const { pluginName } = params return this.callActionHandler({ @@ -217,17 +217,17 @@ export class ActionHelper implements TypeGuard { }) } - async getSecret(params: RequirePluginName>): Promise { + async getSecret(params: RequirePluginName>): Promise { const { pluginName } = params return this.callActionHandler({ actionType: "getSecret", pluginName, params: omit(params, ["pluginName"]) }) } - async setSecret(params: RequirePluginName>): Promise { + async setSecret(params: RequirePluginName>): Promise { const { pluginName } = params return this.callActionHandler({ actionType: "setSecret", pluginName, params: omit(params, ["pluginName"]) }) } - async deleteSecret(params: RequirePluginName>): Promise { + async deleteSecret(params: RequirePluginName>): Promise { const { pluginName } = params return this.callActionHandler({ actionType: "deleteSecret", pluginName, params: omit(params, ["pluginName"]) }) } @@ -239,7 +239,7 @@ export class ActionHelper implements TypeGuard { //=========================================================================== async getBuildStatus( - params: ModuleActionHelperParams>, + params: ModuleActionRouterParams>, ): Promise { return this.callModuleHandler({ params, @@ -248,26 +248,26 @@ export class ActionHelper implements TypeGuard { }) } - async build(params: ModuleActionHelperParams>): Promise { + async build(params: ModuleActionRouterParams>): Promise { return this.callModuleHandler({ params, actionType: "build" }) } async publishModule( - params: ModuleActionHelperParams>, + params: ModuleActionRouterParams>, ): Promise { return this.callModuleHandler({ params, actionType: "publish", defaultHandler: dummyPublishHandler }) } - async runModule(params: ModuleActionHelperParams>): Promise { + async runModule(params: ModuleActionRouterParams>): Promise { return this.callModuleHandler({ params, actionType: "runModule" }) } - async testModule(params: ModuleActionHelperParams>): Promise { + async testModule(params: ModuleActionRouterParams>): Promise { return this.callModuleHandler({ params, actionType: "testModule" }) } async getTestResult( - params: ModuleActionHelperParams>, + params: ModuleActionRouterParams>, ): Promise { return this.callModuleHandler({ params, @@ -282,20 +282,20 @@ export class ActionHelper implements TypeGuard { //region Service Actions //=========================================================================== - async getServiceStatus(params: ServiceActionHelperParams): Promise { + async getServiceStatus(params: ServiceActionRouterParams): Promise { return this.callServiceHandler({ params, actionType: "getServiceStatus" }) } - async deployService(params: ServiceActionHelperParams): Promise { + async deployService(params: ServiceActionRouterParams): Promise { return this.callServiceHandler({ params, actionType: "deployService" }) } - async hotReloadService(params: ServiceActionHelperParams) + async hotReloadService(params: ServiceActionRouterParams) : Promise { return this.callServiceHandler(({ params, actionType: "hotReloadService" })) } - async deleteService(params: ServiceActionHelperParams): Promise { + async deleteService(params: ServiceActionRouterParams): Promise { const log = params.log.info({ section: params.service.name, msg: "Deleting...", @@ -324,23 +324,23 @@ export class ActionHelper implements TypeGuard { return result } - async execInService(params: ServiceActionHelperParams): Promise { + async execInService(params: ServiceActionRouterParams): Promise { return this.callServiceHandler({ params, actionType: "execInService" }) } - async getServiceLogs(params: ServiceActionHelperParams): Promise { + async getServiceLogs(params: ServiceActionRouterParams): Promise { return this.callServiceHandler({ params, actionType: "getServiceLogs", defaultHandler: dummyLogStreamer }) } - async runService(params: ServiceActionHelperParams): Promise { + async runService(params: ServiceActionRouterParams): Promise { return this.callServiceHandler({ params, actionType: "runService" }) } - async getPortForward(params: ServiceActionHelperParams) { + async getPortForward(params: ServiceActionRouterParams) { return this.callServiceHandler({ params, actionType: "getPortForward" }) } - async stopPortForward(params: ServiceActionHelperParams) { + async stopPortForward(params: ServiceActionRouterParams) { return this.callServiceHandler({ params, actionType: "stopPortForward" }) } @@ -350,11 +350,11 @@ export class ActionHelper implements TypeGuard { //region Task Methods //=========================================================================== - async runTask(params: TaskActionHelperParams): Promise { + async runTask(params: TaskActionRouterParams): Promise { return this.callTaskHandler({ params, actionType: "runTask" }) } - async getTaskResult(params: TaskActionHelperParams): Promise { + async getTaskResult(params: TaskActionRouterParams): Promise { return this.callTaskHandler({ params, actionType: "getTaskResult", @@ -479,7 +479,7 @@ export class ActionHelper implements TypeGuard { private async callActionHandler>( { params, actionType, pluginName, defaultHandler }: { - params: ActionHelperParams, + params: ActionRouterParams, actionType: T, pluginName: string, defaultHandler?: PluginActionHandlers[T], @@ -508,7 +508,7 @@ export class ActionHelper implements TypeGuard { private async callModuleHandler>( { params, actionType, defaultHandler }: { - params: ModuleActionHelperParams, + params: ModuleActionRouterParams, actionType: T, defaultHandler?: ModuleActionHandlers[T], }, @@ -539,7 +539,7 @@ export class ActionHelper implements TypeGuard { private async callServiceHandler( { params, actionType, defaultHandler }: { - params: ServiceActionHelperParams, + params: ServiceActionRouterParams, actionType: T, defaultHandler?: ServiceActionHandlers[T], }, @@ -590,7 +590,7 @@ export class ActionHelper implements TypeGuard { private async callTaskHandler( { params, actionType, defaultHandler }: { - params: TaskActionHelperParams, actionType: T, + params: TaskActionRouterParams, actionType: T, defaultHandler?: TaskActionHandlers[T], }, ): Promise { @@ -934,18 +934,18 @@ type WrappedModuleActionMap = { } // avoid having to specify common params on each action helper call -type ActionHelperParams = +type ActionRouterParams = Omit & { pluginName?: string } -type ModuleActionHelperParams = +type ModuleActionRouterParams = Omit & { pluginName?: string } // additionally make runtimeContext param optional -type ServiceActionHelperParams = +type ServiceActionRouterParams = Omit & { pluginName?: string } -type TaskActionHelperParams = +type TaskActionRouterParams = Omit & { pluginName?: string } diff --git a/garden-service/src/commands/call.ts b/garden-service/src/commands/call.ts index 45ecdf0f41..f2141038dc 100644 --- a/garden-service/src/commands/call.ts +++ b/garden-service/src/commands/call.ts @@ -61,7 +61,7 @@ export class CallCommand extends Command { const service = await graph.getService(serviceName) // No need for full context, since we're just checking if the service is running. const runtimeContext = emptyRuntimeContext - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() const status = await actions.getServiceStatus({ service, log, hotReload: false, runtimeContext }) if (!includes(["ready", "outdated"], status.state)) { diff --git a/garden-service/src/commands/delete.ts b/garden-service/src/commands/delete.ts index 053bb98275..7dcaf16687 100644 --- a/garden-service/src/commands/delete.ts +++ b/garden-service/src/commands/delete.ts @@ -67,7 +67,7 @@ export class DeleteSecretCommand extends Command { { garden, log, args }: CommandParams, ): Promise> { const key = args.key! - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() const result = await actions.deleteSecret({ log, pluginName: args.provider!, key }) if (result.found) { @@ -101,7 +101,7 @@ export class DeleteEnvironmentCommand extends Command { async action({ garden, log, headerLog }: CommandParams): Promise> { printHeader(headerLog, `Deleting ${garden.environmentName} environment`, "skull_and_crossbones") - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() const result = await actions.deleteEnvironment(log) return { result } @@ -145,7 +145,7 @@ export class DeleteServiceCommand extends Command { const result: { [key: string]: ServiceStatus } = {} - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() await Bluebird.map(services, async service => { result[service.name] = await actions.deleteService({ log, service }) diff --git a/garden-service/src/commands/exec.ts b/garden-service/src/commands/exec.ts index f0fda86256..aa8399eb2c 100644 --- a/garden-service/src/commands/exec.ts +++ b/garden-service/src/commands/exec.ts @@ -77,7 +77,7 @@ export class ExecCommand extends Command { const graph = await garden.getConfigGraph() const service = await graph.getService(serviceName) - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() const result = await actions.execInService({ log, service, diff --git a/garden-service/src/commands/get/get-debug-info.ts b/garden-service/src/commands/get/get-debug-info.ts index 7c16e7181c..72b05a7ca0 100644 --- a/garden-service/src/commands/get/get-debug-info.ts +++ b/garden-service/src/commands/get/get-debug-info.ts @@ -152,7 +152,7 @@ export async function collectProviderDebugInfo(garden: Garden, log: LogEntry, fo const tempPath = join(garden.gardenDirPath, TEMP_DEBUG_ROOT) await ensureDir(tempPath) // Collect debug info from providers - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() const providersDebugInfo = await actions.getDebugInfo({ log, includeProject }) // Create a provider folder and report for each provider. diff --git a/garden-service/src/commands/get/get-secret.ts b/garden-service/src/commands/get/get-secret.ts index 27d65fe6ef..d15cc3638c 100644 --- a/garden-service/src/commands/get/get-secret.ts +++ b/garden-service/src/commands/get/get-secret.ts @@ -52,7 +52,7 @@ export class GetSecretCommand extends Command { async action({ garden, log, args }: CommandParams): Promise { const key = args.key - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() const { value } = await actions.getSecret({ pluginName: args.provider, key, diff --git a/garden-service/src/commands/get/get-status.ts b/garden-service/src/commands/get/get-status.ts index fb1f315523..ca879c366e 100644 --- a/garden-service/src/commands/get/get-status.ts +++ b/garden-service/src/commands/get/get-status.ts @@ -40,7 +40,7 @@ export class GetStatusCommand extends Command { help = "Outputs the status of your environment." async action({ garden, log, opts }: CommandParams): Promise> { - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() const status = await actions.getStatus({ log }) let result: AllEnvironmentStatus @@ -68,7 +68,7 @@ export class GetStatusCommand extends Command { async function getTestStatuses(garden: Garden, configGraph: ConfigGraph, log: LogEntry) { const modules = await configGraph.getModules() - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() return fromPairs(flatten(await Bluebird.map(modules, async (module) => { return Bluebird.map(module.testConfigs, async (testConfig) => { @@ -83,7 +83,7 @@ async function getTestStatuses(garden: Garden, configGraph: ConfigGraph, log: Lo async function getTaskStatuses(garden: Garden, configGraph: ConfigGraph, log: LogEntry): Promise { const tasks = await configGraph.getTasks() - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() return fromPairs(await Bluebird.map(tasks, async (task) => { const taskVersion = await getTaskVersion(garden, configGraph, task) diff --git a/garden-service/src/commands/get/get-task-result.ts b/garden-service/src/commands/get/get-task-result.ts index bf17fc3ac4..40d830328c 100644 --- a/garden-service/src/commands/get/get-task-result.ts +++ b/garden-service/src/commands/get/get-task-result.ts @@ -43,7 +43,7 @@ export class GetTaskResultCommand extends Command { const graph: ConfigGraph = await garden.getConfigGraph() const task = await graph.getTask(taskName) - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() const result = await actions.getTaskResult( { diff --git a/garden-service/src/commands/get/get-test-result.ts b/garden-service/src/commands/get/get-test-result.ts index 88152028bc..89ecc90a11 100644 --- a/garden-service/src/commands/get/get-test-result.ts +++ b/garden-service/src/commands/get/get-test-result.ts @@ -55,7 +55,7 @@ export class GetTestResultCommand extends Command { ) const graph = await garden.getConfigGraph() - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() const module = await graph.getModule(moduleName) diff --git a/garden-service/src/commands/logs.ts b/garden-service/src/commands/logs.ts index 54ab7819a9..3d71ac6d64 100644 --- a/garden-service/src/commands/logs.ts +++ b/garden-service/src/commands/logs.ts @@ -93,7 +93,7 @@ export class LogsCommand extends Command { } }) - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() const voidLog = log.placeholder(LogLevel.silly, true) await Bluebird.map(services, async (service: Service) => { diff --git a/garden-service/src/commands/run/module.ts b/garden-service/src/commands/run/module.ts index 4bbd7d7c81..dbfac59c38 100644 --- a/garden-service/src/commands/run/module.ts +++ b/garden-service/src/commands/run/module.ts @@ -88,7 +88,7 @@ export class RunModuleCommand extends Command { printHeader(headerLog, msg, "runner") - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() const buildTask = new BuildTask({ garden, log, module, force: opts["force-build"] }) await garden.processTasks([buildTask]) diff --git a/garden-service/src/commands/run/service.ts b/garden-service/src/commands/run/service.ts index ca01e44808..ef3be589fc 100644 --- a/garden-service/src/commands/run/service.ts +++ b/garden-service/src/commands/run/service.ts @@ -66,7 +66,7 @@ export class RunServiceCommand extends Command { "runner", ) - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() // Make sure all dependencies are ready and collect their outputs for the runtime context const deployTask = new DeployTask({ diff --git a/garden-service/src/commands/run/test.ts b/garden-service/src/commands/run/test.ts index 2be2de26e5..7fa5deee01 100644 --- a/garden-service/src/commands/run/test.ts +++ b/garden-service/src/commands/run/test.ts @@ -90,7 +90,7 @@ export class RunTestCommand extends Command { "runner", ) - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() const version = await getTestVersion(garden, graph, module, testConfig) // Make sure all dependencies are ready and collect their outputs for the runtime context diff --git a/garden-service/src/commands/set.ts b/garden-service/src/commands/set.ts index 023be0a491..70113bf464 100644 --- a/garden-service/src/commands/set.ts +++ b/garden-service/src/commands/set.ts @@ -72,7 +72,7 @@ export class SetSecretCommand extends Command { async action({ garden, log, args }: CommandParams): Promise> { const key = args.key - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() const result = await actions.setSecret({ pluginName: args.provider, key, diff --git a/garden-service/src/garden.ts b/garden-service/src/garden.ts index 5b095638a9..a59ac4157b 100644 --- a/garden-service/src/garden.ts +++ b/garden-service/src/garden.ts @@ -43,7 +43,7 @@ import { Watcher } from "./watch" import { findConfigPathsInPath, getConfigFilePath, getWorkingCopyId, fixedExcludes } from "./util/fs" import { Provider, ProviderConfig, getAllProviderDependencyNames, defaultProvider } from "./config/provider" import { ResolveProviderTask, getPluginBaseNames } from "./tasks/resolve-provider" -import { ActionHelper } from "./actions" +import { ActionRouter } from "./actions" import { detectCycles, cyclesToString, Dependency } from "./util/validate-dependencies" import chalk from "chalk" import { RuntimeContext } from "./runtime-context" @@ -120,7 +120,7 @@ export class Garden { public readonly globalConfigStore: GlobalConfigStore public readonly vcs: VcsHandler public readonly cache: TreeCache - private actionHelper: ActionHelper + private actionHelper: ActionRouter public readonly events: EventBus public readonly projectRoot: string @@ -787,7 +787,7 @@ export class Garden { return fromPairs(providers.map(p => [p.name, p.status])) } - async getActionHelper() { + async getActionRouter() { if (!this.actionHelper) { const loadedPlugins = await this.getPlugins() const plugins = keyBy(loadedPlugins, "name") @@ -795,7 +795,7 @@ export class Garden { // We only pass configured plugins to the router (others won't have the required configuration to call handlers) const configuredPlugins = this.getRawProviderConfigs().map(c => plugins[c.name]) - this.actionHelper = new ActionHelper(this, configuredPlugins, loadedPlugins) + this.actionHelper = new ActionRouter(this, configuredPlugins, loadedPlugins) } return this.actionHelper @@ -837,7 +837,7 @@ export class Garden { keys?: string[], opts: ModuleConfigResolveOpts = {}, ): Promise { - const actions = await this.getActionHelper() + const actions = await this.getActionRouter() await this.resolveProviders() const configs = await this.getRawModuleConfigs(keys) diff --git a/garden-service/src/plugins/kubernetes/commands/uninstall-garden-services.ts b/garden-service/src/plugins/kubernetes/commands/uninstall-garden-services.ts index 9358cd89f2..5488123189 100644 --- a/garden-service/src/plugins/kubernetes/commands/uninstall-garden-services.ts +++ b/garden-service/src/plugins/kubernetes/commands/uninstall-garden-services.ts @@ -25,7 +25,7 @@ export const uninstallGardenServices: PluginCommand = { const variables = getKubernetesSystemVariables(k8sCtx.provider.config) const sysGarden = await getSystemGarden(k8sCtx, variables || {}, log) - const actions = await sysGarden.getActionHelper() + const actions = await sysGarden.getActionRouter() const result = await actions.deleteEnvironment(log) diff --git a/garden-service/src/plugins/kubernetes/system.ts b/garden-service/src/plugins/kubernetes/system.ts index ef347f61c1..d26246a1e1 100644 --- a/garden-service/src/plugins/kubernetes/system.ts +++ b/garden-service/src/plugins/kubernetes/system.ts @@ -147,7 +147,7 @@ export async function getSystemServiceStatus( ) { let dashboardPages: DashboardPage[] = [] - const actions = await sysGarden.getActionHelper() + const actions = await sysGarden.getActionRouter() const serviceStatuses = await actions.getServiceStatuses({ log, serviceNames }) const state = combineStates(values(serviceStatuses).map(s => (s && s.state) || "unknown")) @@ -204,7 +204,7 @@ export async function prepareSystemServices( // Deploy enabled system services if (serviceNames.length > 0) { - const actions = await sysGarden.getActionHelper() + const actions = await sysGarden.getActionRouter() const results = await actions.deployServices({ log, serviceNames, diff --git a/garden-service/src/proxy.ts b/garden-service/src/proxy.ts index 4a6fd6c5be..fb8dcfb404 100644 --- a/garden-service/src/proxy.ts +++ b/garden-service/src/proxy.ts @@ -54,7 +54,7 @@ async function startPortProxy(garden: Garden, log: LogEntry, service: Service, s // TODO: handle dead port forwards async function createProxy(garden: Garden, log: LogEntry, service: Service, spec: ForwardablePort): Promise { - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() const key = getPortKey(service, spec) let fwd: GetPortForwardResult diff --git a/garden-service/src/tasks/build.ts b/garden-service/src/tasks/build.ts index e3b7ace84d..3dcb8967c5 100644 --- a/garden-service/src/tasks/build.ts +++ b/garden-service/src/tasks/build.ts @@ -64,7 +64,7 @@ export class BuildTask extends BaseTask { async process(): Promise { const module = this.module - const actions = await this.garden.getActionHelper() + const actions = await this.garden.getActionRouter() const log = this.log.info({ section: this.getName(), diff --git a/garden-service/src/tasks/deploy.ts b/garden-service/src/tasks/deploy.ts index 888e7bf3b8..0fae5ac0f8 100644 --- a/garden-service/src/tasks/deploy.ts +++ b/garden-service/src/tasks/deploy.ts @@ -148,7 +148,7 @@ export class DeployTask extends BaseTask { taskResults, }) - const actions = await this.garden.getActionHelper() + const actions = await this.garden.getActionRouter() let status = serviceStatuses[this.service.name] diff --git a/garden-service/src/tasks/get-service-status.ts b/garden-service/src/tasks/get-service-status.ts index 539eb938fd..36cd471524 100644 --- a/garden-service/src/tasks/get-service-status.ts +++ b/garden-service/src/tasks/get-service-status.ts @@ -97,7 +97,7 @@ export class GetServiceStatusTask extends BaseTask { taskResults, }) - const actions = await this.garden.getActionHelper() + const actions = await this.garden.getActionRouter() // Some handlers expect builds to have been staged when resolving services statuses. await this.garden.buildDir.syncFromSrc(this.service.module, log) diff --git a/garden-service/src/tasks/get-task-result.ts b/garden-service/src/tasks/get-task-result.ts index b2be074020..ab3b288955 100644 --- a/garden-service/src/tasks/get-task-result.ts +++ b/garden-service/src/tasks/get-task-result.ts @@ -48,7 +48,7 @@ export class GetTaskResultTask extends BaseTask { msg: "Checking result...", status: "active", }) - const actions = await this.garden.getActionHelper() + const actions = await this.garden.getActionRouter() let result: RunTaskResult | null try { diff --git a/garden-service/src/tasks/hot-reload.ts b/garden-service/src/tasks/hot-reload.ts index 26d842fffb..edd5b9a228 100644 --- a/garden-service/src/tasks/hot-reload.ts +++ b/garden-service/src/tasks/hot-reload.ts @@ -72,7 +72,7 @@ export class HotReloadTask extends BaseTask { status: "active", }) - const actions = await this.garden.getActionHelper() + const actions = await this.garden.getActionRouter() try { await actions.hotReloadService({ log, service: this.service }) diff --git a/garden-service/src/tasks/publish.ts b/garden-service/src/tasks/publish.ts index 2af9b39dd0..9bf30c7e9c 100644 --- a/garden-service/src/tasks/publish.ts +++ b/garden-service/src/tasks/publish.ts @@ -69,7 +69,7 @@ export class PublishTask extends BaseTask { status: "active", }) - const actions = await this.garden.getActionHelper() + const actions = await this.garden.getActionRouter() let result: PublishResult try { diff --git a/garden-service/src/tasks/resolve-provider.ts b/garden-service/src/tasks/resolve-provider.ts index 92d2096404..bdcbba2aeb 100644 --- a/garden-service/src/tasks/resolve-provider.ts +++ b/garden-service/src/tasks/resolve-provider.ts @@ -116,7 +116,7 @@ export class ResolveProviderTask extends BaseTask { this.log.silly(`Calling configureProvider on ${providerName}`) - const actions = await this.garden.getActionHelper() + const actions = await this.garden.getActionRouter() const configureOutput = await actions.configureProvider({ pluginName: providerName, @@ -169,7 +169,7 @@ export class ResolveProviderTask extends BaseTask { private async ensurePrepared(tmpProvider: Provider) { const pluginName = tmpProvider.name - const actions = await this.garden.getActionHelper() + const actions = await this.garden.getActionRouter() const ctx = this.garden.getPluginContext(tmpProvider) this.log.silly(`Getting status for ${pluginName}`) diff --git a/garden-service/src/tasks/task.ts b/garden-service/src/tasks/task.ts index 9815c2a846..44c46c3c33 100644 --- a/garden-service/src/tasks/task.ts +++ b/garden-service/src/tasks/task.ts @@ -141,7 +141,7 @@ export class TaskTask extends BaseTask { // ... to be renamed soon. taskResults, }) - const actions = await this.garden.getActionHelper() + const actions = await this.garden.getActionRouter() let result: RunTaskResult try { diff --git a/garden-service/src/tasks/test.ts b/garden-service/src/tasks/test.ts index 22a08e7266..3b59249f2f 100644 --- a/garden-service/src/tasks/test.ts +++ b/garden-service/src/tasks/test.ts @@ -147,7 +147,7 @@ export class TestTask extends BaseTask { taskResults, }) - const actions = await this.garden.getActionHelper() + const actions = await this.garden.getActionRouter() let result: TestResult try { @@ -179,7 +179,7 @@ export class TestTask extends BaseTask { return null } - const actions = await this.garden.getActionHelper() + const actions = await this.garden.getActionRouter() return actions.getTestResult({ log: this.log, diff --git a/garden-service/test/unit/src/actions.ts b/garden-service/test/unit/src/actions.ts index 7ce94b055f..a83092814c 100644 --- a/garden-service/test/unit/src/actions.ts +++ b/garden-service/test/unit/src/actions.ts @@ -12,7 +12,7 @@ import { import { Service, ServiceState } from "../../../src/types/service" import { RuntimeContext, prepareRuntimeContext } from "../../../src/runtime-context" import { expectError, makeTestGardenA } from "../../helpers" -import { ActionHelper } from "../../../src/actions" +import { ActionRouter } from "../../../src/actions" import { Garden } from "../../../src/garden" import { LogEntry } from "../../../src/logger/log-entry" import { Module } from "../../../src/types/module" @@ -28,10 +28,10 @@ import { defaultProvider } from "../../../src/config/provider" const now = new Date() -describe("ActionHelper", () => { +describe("ActionRouter", () => { let garden: Garden let log: LogEntry - let actions: ActionHelper + let actions: ActionRouter let module: Module let service: Service let runtimeContext: RuntimeContext @@ -41,7 +41,7 @@ describe("ActionHelper", () => { const plugins = [testPlugin, testPluginB] garden = await makeTestGardenA(plugins) log = garden.log - actions = await garden.getActionHelper() + actions = await garden.getActionRouter() const graph = await garden.getConfigGraph() module = await graph.getModule("module-a") service = await graph.getService("service-a") @@ -404,7 +404,7 @@ describe("ActionHelper", () => { describe("getActionHandler", () => { it("should return the configured handler for specified action type and plugin name", async () => { const gardenA = await makeTestGardenA() - const actionsA = await gardenA.getActionHelper() + const actionsA = await gardenA.getActionRouter() const pluginName = "test-plugin-b" const handler = await actionsA.getActionHandler({ actionType: "prepareEnvironment", pluginName }) @@ -414,7 +414,7 @@ describe("ActionHelper", () => { it("should throw if no handler is available", async () => { const gardenA = await makeTestGardenA() - const actionsA = await gardenA.getActionHelper() + const actionsA = await gardenA.getActionRouter() const pluginName = "test-plugin-b" await expectError(() => actionsA.getActionHandler({ actionType: "cleanupEnvironment", pluginName }), "plugin") }) @@ -425,7 +425,7 @@ describe("ActionHelper", () => { it("should return default handler, if specified and no handler is available", async () => { const gardenA = await makeTestGardenA() - const actionsA = await gardenA.getActionHelper() + const actionsA = await gardenA.getActionRouter() const defaultHandler = async () => { return { code: 0, output: "" } } @@ -441,7 +441,7 @@ describe("ActionHelper", () => { it("should throw if no handler is available", async () => { const gardenA = await makeTestGardenA() - const actionsA = await gardenA.getActionHelper() + const actionsA = await gardenA.getActionRouter() await expectError( () => actionsA.getModuleActionHandler({ actionType: "execInService", moduleType: "container" }), "parameter", @@ -486,7 +486,7 @@ describe("ActionHelper", () => { config: projectConfig, }) - const _actions = await _garden.getActionHelper() + const _actions = await _garden.getActionRouter() const handler = await _actions.getModuleActionHandler({ actionType: "build", moduleType: "bar" }) @@ -547,7 +547,7 @@ describe("ActionHelper", () => { config: projectConfig, }) - const _actions = await _garden.getActionHelper() + const _actions = await _garden.getActionRouter() const handler = await _actions.getModuleActionHandler({ actionType: "build", moduleType: "bar" }) @@ -622,7 +622,7 @@ describe("ActionHelper", () => { config: projectConfig, }) - const _actions = await _garden.getActionHelper() + const _actions = await _garden.getActionRouter() const handler = await _actions.getModuleActionHandler({ actionType: "build", moduleType: "bar" }) @@ -696,7 +696,7 @@ describe("ActionHelper", () => { config: projectConfig, }) - const _actions = await _garden.getActionHelper() + const _actions = await _garden.getActionRouter() const handler = await _actions.getModuleActionHandler({ actionType: "build", moduleType: "bar" }) @@ -757,7 +757,7 @@ describe("ActionHelper", () => { config: projectConfig, }) - const _actions = await _garden.getActionHelper() + const _actions = await _garden.getActionRouter() const handler = await _actions.getModuleActionHandler({ actionType: "build", moduleType: "bar" }) @@ -770,7 +770,7 @@ describe("ActionHelper", () => { describe("callActionHandler", () => { it("should call the handler with a base argument if the handler is overriding another", async () => { - const emptyActions = new ActionHelper(garden, [], []) + const emptyActions = new ActionRouter(garden, [], []) const base = Object.assign( async () => ({ @@ -854,7 +854,7 @@ describe("ActionHelper", () => { config: projectConfig, }) - const _actions = await _garden.getActionHelper() + const _actions = await _garden.getActionRouter() const result = await _actions["callActionHandler"]({ actionType: "getSecret", // Doesn't matter which one it is @@ -871,7 +871,7 @@ describe("ActionHelper", () => { describe("callModuleHandler", () => { it("should call the handler with a base argument if the handler is overriding another", async () => { - const emptyActions = new ActionHelper(garden, [], []) + const emptyActions = new ActionRouter(garden, [], []) const graph = await garden.getConfigGraph() const moduleA = await graph.getModule("module-a") @@ -904,7 +904,7 @@ describe("ActionHelper", () => { describe("callServiceHandler", () => { it("should call the handler with a base argument if the handler is overriding another", async () => { - const emptyActions = new ActionHelper(garden, [], []) + const emptyActions = new ActionRouter(garden, [], []) const graph = await garden.getConfigGraph() const serviceA = await graph.getService("service-a") @@ -939,7 +939,7 @@ describe("ActionHelper", () => { }) it("should interpolate runtime template strings", async () => { - const emptyActions = new ActionHelper(garden, [], []) + const emptyActions = new ActionRouter(garden, [], []) garden["moduleConfigs"]["module-a"].spec.foo = "\${runtime.services.service-b.outputs.foo}" @@ -985,7 +985,7 @@ describe("ActionHelper", () => { }) it("should throw if one or more runtime variables remain unresolved after re-resolution", async () => { - const emptyActions = new ActionHelper(garden, [], []) + const emptyActions = new ActionRouter(garden, [], []) garden["moduleConfigs"]["module-a"].spec.services[0].foo = "\${runtime.services.service-b.outputs.foo}" @@ -1030,7 +1030,7 @@ describe("ActionHelper", () => { describe("callTaskHandler", () => { it("should call the handler with a base argument if the handler is overriding another", async () => { - const emptyActions = new ActionHelper(garden, [], []) + const emptyActions = new ActionRouter(garden, [], []) const graph = await garden.getConfigGraph() const taskA = await graph.getTask("task-a") @@ -1081,7 +1081,7 @@ describe("ActionHelper", () => { }) it("should interpolate runtime template strings", async () => { - const emptyActions = new ActionHelper(garden, [], []) + const emptyActions = new ActionRouter(garden, [], []) garden["moduleConfigs"]["module-a"].spec.tasks[0].foo = "\${runtime.services.service-b.outputs.foo}" @@ -1137,7 +1137,7 @@ describe("ActionHelper", () => { }) it("should throw if one or more runtime variables remain unresolved after re-resolution", async () => { - const emptyActions = new ActionHelper(garden, [], []) + const emptyActions = new ActionRouter(garden, [], []) garden["moduleConfigs"]["module-a"].spec.tasks[0].foo = "\${runtime.services.service-b.outputs.foo}" diff --git a/garden-service/test/unit/src/commands/delete.ts b/garden-service/test/unit/src/commands/delete.ts index bc3a72e4f7..fc39cbf473 100644 --- a/garden-service/test/unit/src/commands/delete.ts +++ b/garden-service/test/unit/src/commands/delete.ts @@ -30,7 +30,7 @@ describe("DeleteSecretCommand", () => { const key = "mykey" const value = "myvalue" - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() await actions.setSecret({ log, key, value, pluginName }) await command.action({ diff --git a/garden-service/test/unit/src/commands/get/get-secret.ts b/garden-service/test/unit/src/commands/get/get-secret.ts index 15abde17ba..3d29c5c8e0 100644 --- a/garden-service/test/unit/src/commands/get/get-secret.ts +++ b/garden-service/test/unit/src/commands/get/get-secret.ts @@ -11,7 +11,7 @@ describe("GetSecretCommand", () => { const log = garden.log const command = new GetSecretCommand() - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() await actions.setSecret({ log, pluginName, diff --git a/garden-service/test/unit/src/commands/set.ts b/garden-service/test/unit/src/commands/set.ts index dfb83267a2..6689865fb9 100644 --- a/garden-service/test/unit/src/commands/set.ts +++ b/garden-service/test/unit/src/commands/set.ts @@ -20,7 +20,7 @@ describe("SetSecretCommand", () => { opts: withDefaultGlobalOpts({}), }) - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() expect(await actions.getSecret({ log, pluginName, key: "mykey" })).to.eql({ value: "myvalue" }) }) }) diff --git a/garden-service/test/unit/src/garden.ts b/garden-service/test/unit/src/garden.ts index 346566ef2a..c97717d5ab 100644 --- a/garden-service/test/unit/src/garden.ts +++ b/garden-service/test/unit/src/garden.ts @@ -45,7 +45,7 @@ describe("Garden", () => { describe("factory", () => { it("should initialize and add the action handlers for a plugin", async () => { const garden = await makeTestGardenA() - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() expect((actions).actionHandlers.prepareEnvironment["test-plugin"]).to.be.ok expect((actions).actionHandlers.prepareEnvironment["test-plugin-b"]).to.be.ok diff --git a/garden-service/test/unit/src/plugins/exec.ts b/garden-service/test/unit/src/plugins/exec.ts index 31e4673d2d..7342c34738 100644 --- a/garden-service/test/unit/src/plugins/exec.ts +++ b/garden-service/test/unit/src/plugins/exec.ts @@ -161,7 +161,7 @@ describe("exec plugin", () => { await writeModuleVersionFile(versionFilePath, version) - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() const result = await actions.getBuildStatus({ log, module }) expect(result.ready).to.be.true @@ -176,7 +176,7 @@ describe("exec plugin", () => { const versionFilePath = join(buildMetadataPath, GARDEN_BUILD_VERSION_FILENAME) await garden.buildDir.syncFromSrc(module, log) - const actions = await garden.getActionHelper() + const actions = await garden.getActionRouter() await actions.build({ log, module }) const versionFileContents = await readModuleVersionFile(versionFilePath)