diff --git a/lib/modules/datasource/maven/index.ts b/lib/modules/datasource/maven/index.ts index 2a6d1bca4b0053f4d682ce09c37d577932d9ee61..70b1da5881139155b8b471aa67b77368ede8b393 100644 --- a/lib/modules/datasource/maven/index.ts +++ b/lib/modules/datasource/maven/index.ts @@ -112,7 +112,7 @@ export class MavenDatasource extends Datasource { return cachedVersions; } - const { authorization, xml: mavenMetadata } = await downloadMavenXml( + const { isCacheable, xml: mavenMetadata } = await downloadMavenXml( this.http, metadataUrl ); @@ -125,7 +125,7 @@ export class MavenDatasource extends Datasource { (acc, version) => ({ ...acc, [version]: null }), {} ); - if (!authorization) { + if (isCacheable) { await packageCache.set(cacheNamespace, cacheKey, releaseMap, 30); } return releaseMap; diff --git a/lib/modules/datasource/maven/types.ts b/lib/modules/datasource/maven/types.ts index c66c311f1604b82eea4a28759924089b71431b44..1a24f174d36ecbc8e5a773512ae540c6fbf6da61 100644 --- a/lib/modules/datasource/maven/types.ts +++ b/lib/modules/datasource/maven/types.ts @@ -9,7 +9,7 @@ export interface MavenDependency { } export interface MavenXml { - authorization?: boolean; + isCacheable?: boolean; xml?: XmlDocument; } diff --git a/lib/modules/datasource/maven/util.ts b/lib/modules/datasource/maven/util.ts index 31dd6042def15c3b47067968a6d65cb5e89e27fc..4ce30dc51b0eb100fbaaf8d2ea33994f0c934bf9 100644 --- a/lib/modules/datasource/maven/util.ts +++ b/lib/modules/datasource/maven/util.ts @@ -150,6 +150,9 @@ export async function downloadMavenXml( if (!pkgUrl) { return {}; } + + let isCacheable = false; + let rawContent: string | undefined; let authorization: boolean | undefined; let statusCode: number | undefined; @@ -178,7 +181,11 @@ export async function downloadMavenXml( return {}; } - return { authorization, xml: new XmlDocument(rawContent) }; + if (!authorization) { + isCacheable = true; + } + + return { isCacheable, xml: new XmlDocument(rawContent) }; } export function getDependencyParts(packageName: string): MavenDependency {