Skip to content

Commit

Permalink
update helm.ts: add try-catch over helm version
Browse files Browse the repository at this point in the history
  • Loading branch information
0x53A committed Jun 19, 2020
1 parent e421cf5 commit 92a1241
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions provider/pkg/gen/nodejs-templates/helm/v2/helm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,17 @@ export class Chart extends yaml.CollectionComponentResource {

// Check the helm version - v2 or v3
let helmVerCmd = `helm version --short || true`;
const helmVer = execSync(
helmVerCmd,
{
stdio: ['pipe', 'pipe', 'ignore'], // Suppress tiller version error
},
).toString();
var helmVer;
try {
helmVer = execSync(
helmVerCmd,
{
stdio: ['pipe', 'pipe', 'ignore'], // Suppress tiller version error
},
).toString();
} catch (e) {
helmVer = e.stdout.toString();
}

cmd = `helm template ${chart} --name-template ${release} --values ${defaultValues} --values ${values} ${apiVersionsArgs} ${namespaceArg}`;
// Helm v2 returns version like this:
Expand Down

0 comments on commit 92a1241

Please sign in to comment.