From c8b9f413c0e134624e86c4b1f1815308152d6ee4 Mon Sep 17 00:00:00 2001 From: Sergei Zharinov Date: Mon, 26 Aug 2024 15:56:41 -0300 Subject: [PATCH 1/2] refactor(github): Use single cache namespace for release attachments --- lib/modules/datasource/github-release-attachments/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/modules/datasource/github-release-attachments/index.ts b/lib/modules/datasource/github-release-attachments/index.ts index 7baec70eea3500..14caabb969ce1d 100644 --- a/lib/modules/datasource/github-release-attachments/index.ts +++ b/lib/modules/datasource/github-release-attachments/index.ts @@ -55,7 +55,7 @@ export class GithubReleaseAttachmentsDatasource extends Datasource { ttlMinutes: 1440, namespace: `datasource-${GithubReleaseAttachmentsDatasource.id}`, key: (release: GithubRestRelease, digest: string) => - `${release.html_url}:${digest}`, + `findDigestFile:${release.html_url}:${digest}`, }) async findDigestFile( release: GithubRestRelease, @@ -83,9 +83,9 @@ export class GithubReleaseAttachmentsDatasource extends Datasource { @cache({ ttlMinutes: 1440, - namespace: 'datasource-github-releases', + namespace: `datasource-${GithubReleaseAttachmentsDatasource.id}`, key: (asset: GithubRestAsset, algorithm: string) => - `${asset.browser_download_url}:${algorithm}:assetDigest`, + `downloadAndDigest:${asset.browser_download_url}:${algorithm}`, }) async downloadAndDigest( asset: GithubRestAsset, From 8c2a6c3b4e44e52dc449669042ce9aecf955cfb9 Mon Sep 17 00:00:00 2001 From: Sergei Zharinov Date: Mon, 26 Aug 2024 15:59:57 -0300 Subject: [PATCH 2/2] Fix --- lib/util/cache/package/key.spec.ts | 4 ++-- lib/util/cache/package/types.ts | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/util/cache/package/key.spec.ts b/lib/util/cache/package/key.spec.ts index 9925dd56ef5765..72f7359bd7dab0 100644 --- a/lib/util/cache/package/key.spec.ts +++ b/lib/util/cache/package/key.spec.ts @@ -3,8 +3,8 @@ import { getCombinedKey } from './key'; describe('util/cache/package/key', () => { describe('getCombinedKey', () => { it('works', () => { - expect(getCombinedKey('datasource-github-releases', 'foo:bar')).toBe( - 'global%%datasource-github-releases%%foo:bar', + expect(getCombinedKey('_test-namespace', 'foo:bar')).toBe( + 'global%%_test-namespace%%foo:bar', ); }); }); diff --git a/lib/util/cache/package/types.ts b/lib/util/cache/package/types.ts index ae3e9ddc240584..dcfd4b43d3ef06 100644 --- a/lib/util/cache/package/types.ts +++ b/lib/util/cache/package/types.ts @@ -63,7 +63,6 @@ export type PackageCacheNamespace = | 'datasource-git' | 'datasource-gitea-releases' | 'datasource-gitea-tags' - | 'datasource-github-releases' | 'datasource-github-release-attachments' | 'datasource-gitlab-packages' | 'datasource-gitlab-releases'