Skip to content

Commit

Permalink
fix(k8s): build status was incorrectly reported for helm modules
Browse files Browse the repository at this point in the history
This had been addressed in a previous branch but I overwrote the
change when rebasing. Basically the generic build status handler
was assuming modules were built if they didn't specify a build command,
which doesn't apply to helm modules (and potentially others).
  • Loading branch information
edvald committed Jul 30, 2018
1 parent f06c812 commit 195eee4
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions garden-cli/src/plugins/generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ export async function parseGenericModule(
}

export async function getGenericModuleBuildStatus({ module }: GetModuleBuildStatusParams): Promise<BuildStatus> {
if (!module.config.build.command.length) {
return { ready: true }
}

const buildVersionFilePath = join(await module.getBuildPath(), GARDEN_BUILD_VERSION_FILENAME)
const builtVersion = await readVersionFile(buildVersionFilePath)
const moduleVersion = await module.getVersion()
Expand All @@ -115,9 +111,10 @@ export async function getGenericModuleBuildStatus({ module }: GetModuleBuildStat

export async function buildGenericModule({ module }: BuildModuleParams<GenericModule>): Promise<BuildResult> {
const config: ModuleConfig = module.config
const output: BuildResult = {}
const buildPath = await module.getBuildPath()

if (config.build.command.length) {
const buildPath = await module.getBuildPath()
const result = await execa.shell(
config.build.command.join(" "),
{
Expand All @@ -126,21 +123,19 @@ export async function buildGenericModule({ module }: BuildModuleParams<GenericMo
},
)

// keep track of which version has been built
const buildVersionFilePath = join(buildPath, GARDEN_BUILD_VERSION_FILENAME)
const version = await module.getVersion()
await writeVersionFile(buildVersionFilePath, {
latestCommit: version.versionString,
dirtyTimestamp: version.dirtyTimestamp,
})

return {
fresh: true,
buildLog: result.stdout,
}
} else {
return {}
output.fresh = true
output.buildLog = result.stdout
}

// keep track of which version has been built
const buildVersionFilePath = join(buildPath, GARDEN_BUILD_VERSION_FILENAME)
const version = await module.getVersion()
await writeVersionFile(buildVersionFilePath, {
latestCommit: version.versionString,
dirtyTimestamp: version.dirtyTimestamp,
})

return output
}

export async function testGenericModule({ module, testConfig }: TestModuleParams<GenericModule>): Promise<TestResult> {
Expand Down

0 comments on commit 195eee4

Please sign in to comment.