Skip to content

Commit

Permalink
fix(manager/helmfile): Add missing helm dependency (#20227)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
  • Loading branch information
nikolaik and viceice committed Feb 6, 2023
1 parent 37161f5 commit cf72e8f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
7 changes: 7 additions & 0 deletions lib/modules/manager/helmfile/artifacts.spec.ts
Expand Up @@ -167,6 +167,8 @@ describe('modules/manager/helmfile/artifacts', () => {
'-w "/tmp/github/some/repo" ' +
'renovate/sidecar ' +
'bash -l -c "' +
'install-tool helm v3.7.2' +
' && ' +
'install-tool helmfile v0.129.0' +
' && ' +
'helmfile deps -f helmfile.yaml' +
Expand All @@ -177,6 +179,7 @@ describe('modules/manager/helmfile/artifacts', () => {
{
binarySource: 'install',
expectedCommands: [
{ cmd: 'install-tool helm v3.7.2' },
{ cmd: 'install-tool helmfile v0.129.0' },
{ cmd: 'helmfile deps -f helmfile.yaml' },
],
Expand All @@ -193,6 +196,10 @@ describe('modules/manager/helmfile/artifacts', () => {
'/tmp/renovate/cache/__renovate-private-cache'
);
fs.getParentDir.mockReturnValue('');
// helm
datasource.getPkgReleases.mockResolvedValueOnce({
releases: [{ version: 'v3.7.2' }],
});
datasource.getPkgReleases.mockResolvedValueOnce({
releases: [{ version: 'v0.129.0' }],
});
Expand Down
17 changes: 11 additions & 6 deletions lib/modules/manager/helmfile/artifacts.ts
Expand Up @@ -3,7 +3,7 @@ import { quote } from 'shlex';
import { TEMPORARY_ERROR } from '../../../constants/error-messages';
import { logger } from '../../../logger';
import { exec } from '../../../util/exec';
import type { ExecOptions, ToolConstraint } from '../../../util/exec/types';
import type { ExecOptions } from '../../../util/exec/types';
import {
getSiblingFileName,
readLocalFile,
Expand Down Expand Up @@ -39,15 +39,20 @@ export async function updateArtifacts({

try {
await writeLocalFile(packageFileName, newPackageFileContent);
const helmfileToolConstraint: ToolConstraint = {
toolName: 'helmfile',
constraint: config.constraints?.helmfile,
};

const execOptions: ExecOptions = {
docker: {},
extraEnv: {},
toolConstraints: [helmfileToolConstraint],
toolConstraints: [
{
toolName: 'helm',
constraint: config.constraints?.helm,
},
{
toolName: 'helmfile',
constraint: config.constraints?.helmfile,
},
],
};
await exec(`helmfile deps -f ${quote(packageFileName)}`, execOptions);

Expand Down

0 comments on commit cf72e8f

Please sign in to comment.