Extend [Nexus] fallback logic to cover repository version badge (#4662)

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
This commit is contained in:
Pierre-Yves B
2020-02-22 00:17:41 +00:00
committed by GitHub
parent 024a2fda22
commit 1d5adac4a9
2 changed files with 15 additions and 2 deletions

View File

@@ -187,11 +187,12 @@ module.exports = class Nexus extends BaseJsonService {
return this.fetch3({ server, repo, groupId, artifactId, queryOpt })
}
// Most servers still use Nexus 2. Fall back to Nexus 3 if the hitting a
// Nexus 2 endpoint returns a Bad Request (=> InvalidResponse).
// Nexus 2 endpoint returns a Bad Request (=> InvalidResponse, for path /service/local/artifact/maven/resolve)
// or a Not Found (for path /service/local/artifact/maven/resolve).
try {
return await this.fetch2({ server, repo, groupId, artifactId, queryOpt })
} catch (e) {
if (e instanceof InvalidResponse) {
if (e instanceof InvalidResponse || e instanceof NotFound) {
return this.fetch3({ server, repo, groupId, artifactId, queryOpt })
}
throw e

View File

@@ -271,6 +271,18 @@ t.create('Nexus 3 - repository version')
message: isVersion,
})
t.create(
'Nexus 3 - repository version valid artifact without explicit nexusVersion parameter'
)
.timeout(15000)
.get(
'/proxy-public-3rd-party-release/com.fasterxml.jackson.core/jackson-databind.json?server=https://nexus.pentaho.org'
)
.expectBadge({
label: 'nexus',
message: isVersion,
})
t.create('Nexus 3 - repository version with query')
.get(
`/proxy-public-3rd-party-release/org.junit.jupiter/junit-jupiter.json?server=https://nexus.pentaho.org&nexusVersion=3&queryOpt=${encodeURIComponent(