Skip to content

Commit

Permalink
fix(k8s): automatic include for helm modules should include chartPath
Browse files Browse the repository at this point in the history
  • Loading branch information
edvald committed Apr 7, 2020
1 parent 59f46bb commit 88c9d26
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion garden-service/src/plugins/kubernetes/helm/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
KubernetesTaskSpec,
namespaceSchema,
} from "../config"
import { posix } from "path"

export const defaultHelmTimeout = 300

Expand Down Expand Up @@ -219,7 +220,7 @@ export const helmModuleSpecSchema = () =>
export async function configureHelmModule({
moduleConfig,
}: ConfigureModuleParams<HelmModule>): Promise<ConfigureModuleResult<HelmModule>> {
const { base, dependencies, serviceResource, skipDeploy, tasks, tests } = moduleConfig.spec
const { base, chartPath, dependencies, serviceResource, skipDeploy, tasks, tests } = moduleConfig.spec

const sourceModuleName = serviceResource ? serviceResource.containerModule : undefined

Expand Down Expand Up @@ -296,6 +297,8 @@ export async function configureHelmModule({
moduleConfig.include = containsSources
? ["*", "charts/**/*", "templates/**/*", ...valueFiles]
: ["*.yaml", "*.yml", ...valueFiles]

moduleConfig.include = moduleConfig.include.map((path) => posix.join(chartPath, path))
}

return { moduleConfig }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ describe("configureHelmModule", () => {
// So that Chart.yaml isn't found
patchModuleConfig("api", { spec: { chartPath: "invalid-path" } })
const config = await garden.resolveModule("api")
expect(config.include).to.eql(["*.yaml", "*.yml"])
expect(config.include).to.eql(["invalid-path/*.yaml", "invalid-path/*.yml"])
})

it("should not return a serviceConfig if skipDeploy=true", async () => {
Expand Down

0 comments on commit 88c9d26

Please sign in to comment.