diff --git a/garden-service/src/plugins/kubernetes/helm/config.ts b/garden-service/src/plugins/kubernetes/helm/config.ts index a73fd6df35..1a9f645df6 100644 --- a/garden-service/src/plugins/kubernetes/helm/config.ts +++ b/garden-service/src/plugins/kubernetes/helm/config.ts @@ -352,5 +352,10 @@ export async function configureHelmModule({ "release-name": getReleaseName(moduleConfig), } + // Automatically set the include if not explicitly set + if (!moduleConfig.include) { + moduleConfig.include = containsSources ? ["*", "charts/**/*", "templates/**/*"] : [] + } + return { moduleConfig } } diff --git a/garden-service/test/integ/src/plugins/kubernetes/helm/config.ts b/garden-service/test/integ/src/plugins/kubernetes/helm/config.ts index 2ba1c0f0d0..c7a89c4205 100644 --- a/garden-service/test/integ/src/plugins/kubernetes/helm/config.ts +++ b/garden-service/test/integ/src/plugins/kubernetes/helm/config.ts @@ -46,7 +46,7 @@ describe("validateHelmModule", () => { }, configPath: resolve(ctx.projectRoot, "api", "garden.yml"), description: "The API backend for the voting UI", - include: undefined, + include: ["*", "charts/**/*", "templates/**/*"], exclude: undefined, name: "api", outputs: { @@ -122,6 +122,19 @@ describe("validateHelmModule", () => { }) }) + it("should not set default includes if they have already been explicitly set", async () => { + patchModuleConfig("api", { include: ["foo"] }) + const config = await garden.resolveModuleConfig(garden.log, "api") + expect(config.include).to.eql(["foo"]) + }) + + it("should set include to empty if module does not have local chart sources", async () => { + // So that Chart.yaml isn't found + patchModuleConfig("api", { spec: { chartPath: "invalid-path" } }) + const config = await garden.resolveModuleConfig(garden.log, "api") + expect(config.include).to.eql([]) + }) + it("should not return a serviceConfig if skipDeploy=true", async () => { patchModuleConfig("api", { spec: { skipDeploy: true } }) const config = await garden.resolveModuleConfig(garden.log, "api")