From 5f051410a7503b38de84f68a1f1d612460716593 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Mon, 8 Jan 2024 11:45:46 +0100 Subject: [PATCH 1/2] fix(datasource/docker): add cache decorator to `getDockerHubTags` --- lib/modules/datasource/docker/index.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/modules/datasource/docker/index.ts b/lib/modules/datasource/docker/index.ts index b18db9417eb3f0..6d34d08cddbb9b 100644 --- a/lib/modules/datasource/docker/index.ts +++ b/lib/modules/datasource/docker/index.ts @@ -176,7 +176,7 @@ export class DockerDatasource extends Datasource { ) => `${registryHost}:${dockerRepository}@${configDigest}`, ttlMinutes: 1440 * 28, }) - public async getImageConfig( + async getImageConfig( registryHost: string, dockerRepository: string, configDigest: string, @@ -221,7 +221,7 @@ export class DockerDatasource extends Datasource { ) => `${registryHost}:${dockerRepository}@${configDigest}`, ttlMinutes: 1440 * 28, }) - public async getHelmConfig( + async getHelmConfig( registryHost: string, dockerRepository: string, configDigest: string, @@ -336,7 +336,7 @@ export class DockerDatasource extends Datasource { ) => `${registryHost}:${dockerRepository}@${currentDigest}`, ttlMinutes: 1440 * 28, }) - public async getImageArchitecture( + async getImageArchitecture( registryHost: string, dockerRepository: string, currentDigest: string, @@ -434,7 +434,7 @@ export class DockerDatasource extends Datasource { `${registryHost}:${dockerRepository}:${tag}`, ttlMinutes: 24 * 60, }) - public async getLabels( + async getLabels( registryHost: string, dockerRepository: string, tag: string, @@ -687,7 +687,7 @@ export class DockerDatasource extends Datasource { key: (registryHost: string, dockerRepository: string) => `${registryHost}:${dockerRepository}`, }) - public async getTags( + async getTags( registryHost: string, dockerRepository: string, ): Promise { @@ -913,6 +913,11 @@ export class DockerDatasource extends Datasource { return digest; } + @cache({ + namespace: 'datasource-docker-hub-tags', + key: (registryHost: string, dockerRepository: string) => + `${registryHost}:${dockerRepository}`, + }) async getDockerHubTags(dockerRepository: string): Promise { const result: Release[] = []; let url: null | string = From 2efb0feb496db46606db320be2284fb753e30ad3 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Mon, 8 Jan 2024 12:07:28 +0100 Subject: [PATCH 2/2] fix: update cache key --- lib/modules/datasource/docker/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/modules/datasource/docker/index.ts b/lib/modules/datasource/docker/index.ts index 6d34d08cddbb9b..ea9e6dd897098e 100644 --- a/lib/modules/datasource/docker/index.ts +++ b/lib/modules/datasource/docker/index.ts @@ -915,8 +915,7 @@ export class DockerDatasource extends Datasource { @cache({ namespace: 'datasource-docker-hub-tags', - key: (registryHost: string, dockerRepository: string) => - `${registryHost}:${dockerRepository}`, + key: (dockerRepository: string) => `${dockerRepository}`, }) async getDockerHubTags(dockerRepository: string): Promise { const result: Release[] = [];