Skip to content

Commit

Permalink
fix(core): fix empty runtimeContext check
Browse files Browse the repository at this point in the history
Before this fix, calls to service action handlers for services with
runtime dependencies in template variables would fail if an empty
runtimeContext was passed, even if the service handler in question
doesn't need environment variables (e.g. getServiceStatus and
getServiceLogs).
  • Loading branch information
thsig authored and edvald committed Dec 17, 2019
1 parent fb20178 commit 0b2eae5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion garden-service/src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,11 @@ export class ActionRouter implements TypeGuard {
})

// Resolve ${runtime.*} template strings if needed.
if (runtimeContext && (await getRuntimeTemplateReferences(module)).length > 0) {
const runtimeContextIsEmpty = runtimeContext
? Object.keys(runtimeContext.envVars).length === 0 && runtimeContext.dependencies.length === 0
: true

if (!runtimeContextIsEmpty && (await getRuntimeTemplateReferences(module)).length > 0) {
log.silly(`Resolving runtime template strings for service '${service.name}'`)
const configContext = await this.garden.getModuleConfigContext(runtimeContext)
const graph = await this.garden.getConfigGraph(log, { configContext })
Expand Down

0 comments on commit 0b2eae5

Please sign in to comment.