aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lib/modules/datasource/go/releases-goproxy.spec.ts5
-rw-r--r--lib/modules/datasource/go/releases-goproxy.ts15
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) {