fix(datasource/docker): add cache decorator to getDockerHubTags (#26546)

This commit is contained in:
Michael Kriese 2024-01-08 12:34:55 +01:00 committed by GitHub
parent 085ef7c038
commit b33d09cbc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -176,7 +176,7 @@ export class DockerDatasource extends Datasource {
) => `${registryHost}:${dockerRepository}@${configDigest}`, ) => `${registryHost}:${dockerRepository}@${configDigest}`,
ttlMinutes: 1440 * 28, ttlMinutes: 1440 * 28,
}) })
public async getImageConfig( async getImageConfig(
registryHost: string, registryHost: string,
dockerRepository: string, dockerRepository: string,
configDigest: string, configDigest: string,
@ -221,7 +221,7 @@ export class DockerDatasource extends Datasource {
) => `${registryHost}:${dockerRepository}@${configDigest}`, ) => `${registryHost}:${dockerRepository}@${configDigest}`,
ttlMinutes: 1440 * 28, ttlMinutes: 1440 * 28,
}) })
public async getHelmConfig( async getHelmConfig(
registryHost: string, registryHost: string,
dockerRepository: string, dockerRepository: string,
configDigest: string, configDigest: string,
@ -336,7 +336,7 @@ export class DockerDatasource extends Datasource {
) => `${registryHost}:${dockerRepository}@${currentDigest}`, ) => `${registryHost}:${dockerRepository}@${currentDigest}`,
ttlMinutes: 1440 * 28, ttlMinutes: 1440 * 28,
}) })
public async getImageArchitecture( async getImageArchitecture(
registryHost: string, registryHost: string,
dockerRepository: string, dockerRepository: string,
currentDigest: string, currentDigest: string,
@ -434,7 +434,7 @@ export class DockerDatasource extends Datasource {
`${registryHost}:${dockerRepository}:${tag}`, `${registryHost}:${dockerRepository}:${tag}`,
ttlMinutes: 24 * 60, ttlMinutes: 24 * 60,
}) })
public async getLabels( async getLabels(
registryHost: string, registryHost: string,
dockerRepository: string, dockerRepository: string,
tag: string, tag: string,
@ -687,7 +687,7 @@ export class DockerDatasource extends Datasource {
key: (registryHost: string, dockerRepository: string) => key: (registryHost: string, dockerRepository: string) =>
`${registryHost}:${dockerRepository}`, `${registryHost}:${dockerRepository}`,
}) })
public async getTags( async getTags(
registryHost: string, registryHost: string,
dockerRepository: string, dockerRepository: string,
): Promise<string[] | null> { ): Promise<string[] | null> {
@ -913,6 +913,10 @@ export class DockerDatasource extends Datasource {
return digest; return digest;
} }
@cache({
namespace: 'datasource-docker-hub-tags',
key: (dockerRepository: string) => `${dockerRepository}`,
})
async getDockerHubTags(dockerRepository: string): Promise<Release[] | null> { async getDockerHubTags(dockerRepository: string): Promise<Release[] | null> {
const result: Release[] = []; const result: Release[] = [];
let url: null | string = let url: null | string =