diff options
author | Sergei Zharinov <[email protected]> | 2024-12-20 12:01:58 -0300 |
---|---|---|
committer | GitHub <[email protected]> | 2024-12-20 15:01:58 +0000 |
commit | 6072a3577f319caa65e40ca6faea8ac341f9a9ea (patch) | |
tree | d6ded86bc4beafe9809599cb13656c1c19bc695f | |
parent | c69df699dab74df010de1e6306d8b6ab7b994574 (diff) | |
download | renovate-6072a3577f319caa65e40ca6faea8ac341f9a9ea.tar.gz renovate-6072a3577f319caa65e40ca6faea8ac341f9a9ea.zip |
fix(go): Request only info for versions with the same major (#33169)
-rw-r--r-- | lib/modules/datasource/go/releases-goproxy.spec.ts | 5 | ||||
-rw-r--r-- | lib/modules/datasource/go/releases-goproxy.ts | 15 |
2 files changed, 18 insertions, 2 deletions
diff --git a/lib/modules/datasource/go/releases-goproxy.spec.ts b/lib/modules/datasource/go/releases-goproxy.spec.ts index de9313b8c57..2d6950d057f 100644 --- a/lib/modules/datasource/go/releases-goproxy.spec.ts +++ b/lib/modules/datasource/go/releases-goproxy.spec.ts @@ -494,7 +494,10 @@ describe('modules/datasource/go/releases-goproxy', () => { .get('.v2/@latest') .reply(200, { Version: 'v2.4.0' }) .get('.v3/@v/list') - .reply(200, ['v3.0.0', 'v3.0.1', ' \n'].join('\n')) + .reply( + 200, + ['v1.0.0', 'v2.0.0', 'v3.0.0', 'v3.0.1', 'v4.0.0', ' \n'].join('\n'), + ) .get('.v3/@v/v3.0.0.info') .reply(200, { Version: 'v3.0.0', Time: '2022-05-21T10:33:21Z' }) .get('.v3/@v/v3.0.1.info') diff --git a/lib/modules/datasource/go/releases-goproxy.ts b/lib/modules/datasource/go/releases-goproxy.ts index 951a857afab..1a2a9d301cb 100644 --- a/lib/modules/datasource/go/releases-goproxy.ts +++ b/lib/modules/datasource/go/releases-goproxy.ts @@ -217,7 +217,20 @@ export class GoProxyDatasource extends Datasource { try { const res = await this.listVersions(baseUrl, pkg); - releases = await p.map(res, async (versionInfo) => { + + // Artifactory returns all versions in any major (past and future), + // so starting from v2, we filter them in order to avoid the infinite loop + const filteredReleases = res.filter(({ version }) => { + if (major < 2) { + return true; + } + + return ( + version.split(regEx(/[^\d]+/)).find(is.truthy) === major.toString() + ); + }); + + releases = await p.map(filteredReleases, async (versionInfo) => { const { version, newDigest, releaseTimestamp } = versionInfo; if (releaseTimestamp) { |