mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 15:06:27 +00:00
feat(repo/lookup): log registry urls used at the lookup phase (#19332)
This commit is contained in:
parent
645f5d5194
commit
66159ac549
7 changed files with 49 additions and 17 deletions
|
@ -139,20 +139,21 @@ async function mergeRegistries(
|
||||||
for (const registryUrl of registryUrls) {
|
for (const registryUrl of registryUrls) {
|
||||||
try {
|
try {
|
||||||
const res = await getRegistryReleases(datasource, config, registryUrl);
|
const res = await getRegistryReleases(datasource, config, registryUrl);
|
||||||
if (res) {
|
if (!res) {
|
||||||
if (combinedRes) {
|
continue;
|
||||||
for (const existingRelease of combinedRes.releases || []) {
|
}
|
||||||
existingRelease.registryUrl = combinedRes.registryUrl;
|
if (combinedRes) {
|
||||||
}
|
for (const existingRelease of combinedRes.releases || []) {
|
||||||
for (const additionalRelease of res.releases || []) {
|
existingRelease.registryUrl ??= combinedRes.registryUrl;
|
||||||
additionalRelease.registryUrl = res.registryUrl;
|
|
||||||
}
|
|
||||||
combinedRes = { ...res, ...combinedRes };
|
|
||||||
delete combinedRes.registryUrl;
|
|
||||||
combinedRes.releases = [...combinedRes.releases, ...res.releases];
|
|
||||||
} else {
|
|
||||||
combinedRes = res;
|
|
||||||
}
|
}
|
||||||
|
for (const additionalRelease of res.releases || []) {
|
||||||
|
additionalRelease.registryUrl = res.registryUrl;
|
||||||
|
}
|
||||||
|
combinedRes = { ...res, ...combinedRes };
|
||||||
|
delete combinedRes.registryUrl;
|
||||||
|
combinedRes.releases = [...combinedRes.releases, ...res.releases];
|
||||||
|
} else {
|
||||||
|
combinedRes = res;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof ExternalHostError) {
|
if (err instanceof ExternalHostError) {
|
||||||
|
|
|
@ -135,6 +135,7 @@ export interface LookupUpdate {
|
||||||
checksumUrl?: string;
|
checksumUrl?: string;
|
||||||
downloadUrl?: string;
|
downloadUrl?: string;
|
||||||
releaseTimestamp?: any;
|
releaseTimestamp?: any;
|
||||||
|
registryUrl?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PackageDependency<T = Record<string, any>> extends Package<T> {
|
export interface PackageDependency<T = Record<string, any>> extends Package<T> {
|
||||||
|
|
|
@ -8,6 +8,7 @@ exports[`workers/repository/process/lookup/index .lookupUpdates() handles digest
|
||||||
"fixedVersion": "8.0.0",
|
"fixedVersion": "8.0.0",
|
||||||
"homepage": undefined,
|
"homepage": undefined,
|
||||||
"isSingleVersion": true,
|
"isSingleVersion": true,
|
||||||
|
"registryUrl": undefined,
|
||||||
"sourceUrl": "https://github.com/nodejs/node",
|
"sourceUrl": "https://github.com/nodejs/node",
|
||||||
"updates": [
|
"updates": [
|
||||||
{
|
{
|
||||||
|
@ -53,6 +54,7 @@ exports[`workers/repository/process/lookup/index .lookupUpdates() handles digest
|
||||||
"dependencyUrl": undefined,
|
"dependencyUrl": undefined,
|
||||||
"fixedVersion": "8.1.0",
|
"fixedVersion": "8.1.0",
|
||||||
"homepage": undefined,
|
"homepage": undefined,
|
||||||
|
"registryUrl": undefined,
|
||||||
"sourceUrl": "https://github.com/nodejs/node",
|
"sourceUrl": "https://github.com/nodejs/node",
|
||||||
"updates": [
|
"updates": [
|
||||||
{
|
{
|
||||||
|
@ -75,6 +77,7 @@ exports[`workers/repository/process/lookup/index .lookupUpdates() handles digest
|
||||||
"fixedVersion": "8.0.0",
|
"fixedVersion": "8.0.0",
|
||||||
"homepage": undefined,
|
"homepage": undefined,
|
||||||
"isSingleVersion": true,
|
"isSingleVersion": true,
|
||||||
|
"registryUrl": undefined,
|
||||||
"sourceUrl": "https://github.com/nodejs/node",
|
"sourceUrl": "https://github.com/nodejs/node",
|
||||||
"updates": [
|
"updates": [
|
||||||
{
|
{
|
||||||
|
@ -132,6 +135,7 @@ exports[`workers/repository/process/lookup/index .lookupUpdates() handles replac
|
||||||
"dependencyUrl": undefined,
|
"dependencyUrl": undefined,
|
||||||
"fixedVersion": "1.4.1",
|
"fixedVersion": "1.4.1",
|
||||||
"homepage": undefined,
|
"homepage": undefined,
|
||||||
|
"registryUrl": "https://registry.npmjs.org",
|
||||||
"sourceUrl": "https://github.com/kriskowal/q",
|
"sourceUrl": "https://github.com/kriskowal/q",
|
||||||
"updates": [
|
"updates": [
|
||||||
{
|
{
|
||||||
|
@ -153,6 +157,7 @@ exports[`workers/repository/process/lookup/index .lookupUpdates() handles source
|
||||||
"fixedVersion": "0.9.99",
|
"fixedVersion": "0.9.99",
|
||||||
"homepage": undefined,
|
"homepage": undefined,
|
||||||
"isSingleVersion": true,
|
"isSingleVersion": true,
|
||||||
|
"registryUrl": "https://registry.npmjs.org",
|
||||||
"sourceUrl": "https://github.com/kriskowal/q",
|
"sourceUrl": "https://github.com/kriskowal/q",
|
||||||
"updates": [
|
"updates": [
|
||||||
{
|
{
|
||||||
|
@ -215,6 +220,7 @@ Marking the latest version of an npm package as deprecated results in the entire
|
||||||
"fixedVersion": "1.3.0",
|
"fixedVersion": "1.3.0",
|
||||||
"homepage": undefined,
|
"homepage": undefined,
|
||||||
"isSingleVersion": true,
|
"isSingleVersion": true,
|
||||||
|
"registryUrl": "https://registry.npmjs.org",
|
||||||
"sourceUrl": "https://github.com/kriskowal/q",
|
"sourceUrl": "https://github.com/kriskowal/q",
|
||||||
"updates": [
|
"updates": [
|
||||||
{
|
{
|
||||||
|
@ -240,6 +246,7 @@ exports[`workers/repository/process/lookup/index .lookupUpdates() is deprecated
|
||||||
"fixedVersion": "1.3.0",
|
"fixedVersion": "1.3.0",
|
||||||
"homepage": undefined,
|
"homepage": undefined,
|
||||||
"isSingleVersion": true,
|
"isSingleVersion": true,
|
||||||
|
"registryUrl": "https://registry.npmjs.org",
|
||||||
"sourceDirectory": "test",
|
"sourceDirectory": "test",
|
||||||
"sourceUrl": "https://github.com/kriskowal/q",
|
"sourceUrl": "https://github.com/kriskowal/q",
|
||||||
"updates": [
|
"updates": [
|
||||||
|
@ -298,6 +305,7 @@ exports[`workers/repository/process/lookup/index .lookupUpdates() returns comple
|
||||||
"fixedVersion": "1.3.0",
|
"fixedVersion": "1.3.0",
|
||||||
"homepage": undefined,
|
"homepage": undefined,
|
||||||
"isSingleVersion": true,
|
"isSingleVersion": true,
|
||||||
|
"registryUrl": "https://registry.npmjs.org",
|
||||||
"sourceUrl": "https://github.com/kriskowal/q",
|
"sourceUrl": "https://github.com/kriskowal/q",
|
||||||
"updates": [
|
"updates": [
|
||||||
{
|
{
|
||||||
|
@ -464,6 +472,7 @@ exports[`workers/repository/process/lookup/index .lookupUpdates() should downgra
|
||||||
"newMajor": 1,
|
"newMajor": 1,
|
||||||
"newValue": "1.16.0",
|
"newValue": "1.16.0",
|
||||||
"newVersion": "1.16.0",
|
"newVersion": "1.16.0",
|
||||||
|
"registryUrl": undefined,
|
||||||
"updateType": "rollback",
|
"updateType": "rollback",
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
@ -517,6 +526,7 @@ exports[`workers/repository/process/lookup/index .lookupUpdates() should roll ba
|
||||||
"newMajor": 3,
|
"newMajor": 3,
|
||||||
"newValue": "3.0.1-insiders.20180726",
|
"newValue": "3.0.1-insiders.20180726",
|
||||||
"newVersion": "3.0.1-insiders.20180726",
|
"newVersion": "3.0.1-insiders.20180726",
|
||||||
|
"registryUrl": undefined,
|
||||||
"updateType": "rollback",
|
"updateType": "rollback",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -546,6 +556,7 @@ exports[`workers/repository/process/lookup/index .lookupUpdates() skips uncompat
|
||||||
"fixedVersion": "8",
|
"fixedVersion": "8",
|
||||||
"homepage": undefined,
|
"homepage": undefined,
|
||||||
"isSingleVersion": true,
|
"isSingleVersion": true,
|
||||||
|
"registryUrl": undefined,
|
||||||
"sourceUrl": "https://github.com/nodejs/node",
|
"sourceUrl": "https://github.com/nodejs/node",
|
||||||
"updates": [
|
"updates": [
|
||||||
{
|
{
|
||||||
|
@ -570,6 +581,7 @@ exports[`workers/repository/process/lookup/index .lookupUpdates() skips uncompat
|
||||||
"fixedVersion": "8.1",
|
"fixedVersion": "8.1",
|
||||||
"homepage": undefined,
|
"homepage": undefined,
|
||||||
"isSingleVersion": true,
|
"isSingleVersion": true,
|
||||||
|
"registryUrl": undefined,
|
||||||
"sourceUrl": "https://github.com/nodejs/node",
|
"sourceUrl": "https://github.com/nodejs/node",
|
||||||
"updates": [
|
"updates": [
|
||||||
{
|
{
|
||||||
|
@ -602,6 +614,7 @@ exports[`workers/repository/process/lookup/index .lookupUpdates() skips uncompat
|
||||||
"fixedVersion": "8.1.0",
|
"fixedVersion": "8.1.0",
|
||||||
"homepage": undefined,
|
"homepage": undefined,
|
||||||
"isSingleVersion": true,
|
"isSingleVersion": true,
|
||||||
|
"registryUrl": undefined,
|
||||||
"sourceUrl": "https://github.com/nodejs/node",
|
"sourceUrl": "https://github.com/nodejs/node",
|
||||||
"updates": [
|
"updates": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,6 +37,15 @@ export function generateUpdate(
|
||||||
if (release.releaseTimestamp !== undefined) {
|
if (release.releaseTimestamp !== undefined) {
|
||||||
update.releaseTimestamp = release.releaseTimestamp;
|
update.releaseTimestamp = release.releaseTimestamp;
|
||||||
}
|
}
|
||||||
|
// istanbul ignore if
|
||||||
|
if (release.registryUrl !== undefined) {
|
||||||
|
/**
|
||||||
|
* This means:
|
||||||
|
* - registry strategy is set to merge
|
||||||
|
* - releases were fetched from multiple registry urls
|
||||||
|
*/
|
||||||
|
update.registryUrl = release.registryUrl;
|
||||||
|
}
|
||||||
|
|
||||||
const { currentValue } = config;
|
const { currentValue } = config;
|
||||||
if (currentValue) {
|
if (currentValue) {
|
||||||
|
|
|
@ -95,6 +95,7 @@ export async function lookupUpdates(
|
||||||
}
|
}
|
||||||
|
|
||||||
res.sourceUrl = dependency?.sourceUrl;
|
res.sourceUrl = dependency?.sourceUrl;
|
||||||
|
res.registryUrl = dependency?.registryUrl; // undefined when we fetched releases from multiple registries
|
||||||
if (dependency.sourceDirectory) {
|
if (dependency.sourceDirectory) {
|
||||||
res.sourceDirectory = dependency.sourceDirectory;
|
res.sourceDirectory = dependency.sourceDirectory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,14 +40,19 @@ export function getRollbackUpdate(
|
||||||
);
|
);
|
||||||
|
|
||||||
lessThanVersions.sort((a, b) => version.sortVersions(a.version, b.version));
|
lessThanVersions.sort((a, b) => version.sortVersions(a.version, b.version));
|
||||||
let newVersion;
|
let newRelease;
|
||||||
if (currentValue && version.isStable(currentValue)) {
|
if (currentValue && version.isStable(currentValue)) {
|
||||||
newVersion = lessThanVersions
|
newRelease = lessThanVersions
|
||||||
.filter((v) => version.isStable(v.version))
|
.filter((v) => version.isStable(v.version))
|
||||||
.pop()?.version;
|
.pop();
|
||||||
}
|
}
|
||||||
|
let newVersion = newRelease?.version;
|
||||||
|
let registryUrl = newRelease?.registryUrl;
|
||||||
|
|
||||||
if (!newVersion) {
|
if (!newVersion) {
|
||||||
newVersion = lessThanVersions.pop()?.version;
|
newRelease = lessThanVersions.pop();
|
||||||
|
newVersion = newRelease?.version;
|
||||||
|
registryUrl = newRelease?.registryUrl;
|
||||||
}
|
}
|
||||||
// istanbul ignore if
|
// istanbul ignore if
|
||||||
if (!newVersion) {
|
if (!newVersion) {
|
||||||
|
@ -66,6 +71,7 @@ export function getRollbackUpdate(
|
||||||
newMajor: version.getMajor(newVersion)!,
|
newMajor: version.getMajor(newVersion)!,
|
||||||
newValue: newValue!,
|
newValue: newValue!,
|
||||||
newVersion,
|
newVersion,
|
||||||
|
registryUrl,
|
||||||
updateType: 'rollback',
|
updateType: 'rollback',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@ export interface UpdateResult {
|
||||||
currentVersion?: string;
|
currentVersion?: string;
|
||||||
isSingleVersion?: boolean;
|
isSingleVersion?: boolean;
|
||||||
skipReason?: SkipReason;
|
skipReason?: SkipReason;
|
||||||
|
registryUrl?: string;
|
||||||
releases: Release[];
|
releases: Release[];
|
||||||
fixedVersion?: string;
|
fixedVersion?: string;
|
||||||
updates: LookupUpdate[];
|
updates: LookupUpdate[];
|
||||||
|
|
Loading…
Reference in a new issue