Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(datasource/helm): Digests are blank on Gitlab #24280

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/modules/datasource/helm/__fixtures__/index_blank-digest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
entries:
blank-digest:
- apiVersion: v2
created: '2023-09-05T13:24:19.046604000Z'
description: A Helm chart with a blank digest
digest:
name: blank-digest
urls:
- charts/blank-digest-3.2.1.tgz
version: 3.2.1
generated: '2023-09-06T15:21:28.525139938Z'
serverInfo:
contextPath: "/api/v4/projects/98765431/packages/helm"
24 changes: 23 additions & 1 deletion lib/modules/datasource/helm/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('modules/datasource/helm/index', () => {
httpMock
.scope('https://example-repository.com')
.get('/index.yaml')
.reply(200, undefined);
.reply(200);
expect(
await getPkgReleases({
datasource: HelmDatasource.id,
Expand Down Expand Up @@ -203,5 +203,27 @@ describe('modules/datasource/helm/index', () => {
releases: expect.toBeArrayOfSize(27),
});
});

it('uses undefined as the newDigest when no digest is provided', async () => {
httpMock
.scope('https://example-repository.com')
.get('/index.yaml')
.reply(200, Fixtures.get('index_blank-digest.yaml'));
const releases = await getPkgReleases({
datasource: HelmDatasource.id,
packageName: 'blank-digest',
registryUrls: ['https://example-repository.com'],
});
expect(releases).toMatchObject({
registryUrl: 'https://example-repository.com',
releases: [
{
newDigest: undefined,
releaseTimestamp: '2023-09-05T13:24:19.046Z',
version: '3.2.1',
},
],
});
});
});
});
3 changes: 2 additions & 1 deletion lib/modules/datasource/helm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ export class HelmDatasource extends Datasource {
releases: releases.map((release) => ({
version: release.version,
releaseTimestamp: release.created ?? null,
newDigest: release.digest,
// The Helm repository at Gitlab does not include a digest (#24280)
newDigest: release.digest ?? undefined,
})),
};
}
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/datasource/helm/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export interface HelmRelease {
sources?: string[];
version: string;
created: string;
digest: string;
digest: string | null;
urls: string[];
}

Expand Down
Loading