mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
fix: immortal digest groups (#18402)
This commit is contained in:
parent
908be27404
commit
5dfc850b3b
2 changed files with 52 additions and 22 deletions
|
@ -238,6 +238,36 @@ describe('workers/repository/updates/generate', () => {
|
||||||
expect(res.recreateClosed).toBeFalsy();
|
expect(res.recreateClosed).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('groups multiple digest updates immortally', () => {
|
||||||
|
const branch: BranchUpgradeConfig[] = [
|
||||||
|
{
|
||||||
|
manager: 'some-manager',
|
||||||
|
depName: 'some-dep',
|
||||||
|
groupName: 'some-group',
|
||||||
|
branchName: 'some-branch',
|
||||||
|
prTitle: 'some-title',
|
||||||
|
commitMessageExtra: 'to {{{newDigestShort}}}',
|
||||||
|
newValue: '5.1.2',
|
||||||
|
newDigest: 'sha256:abcdef123',
|
||||||
|
isDigest: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
manager: 'some-manager',
|
||||||
|
depName: 'some-other-dep',
|
||||||
|
groupName: 'some-group',
|
||||||
|
branchName: 'some-branch',
|
||||||
|
prTitle: 'some-title',
|
||||||
|
commitMessageExtra: 'to {{{newDigestShort}}}',
|
||||||
|
newValue: '5.2.0',
|
||||||
|
newDigest: 'sha256:abcdef987654321',
|
||||||
|
isDigest: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const res = generateBranchConfig(branch);
|
||||||
|
expect(res.groupName).toBeDefined();
|
||||||
|
expect(res.recreateClosed).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
it('groups multiple upgrades different version', () => {
|
it('groups multiple upgrades different version', () => {
|
||||||
const branch: BranchUpgradeConfig[] = [
|
const branch: BranchUpgradeConfig[] = [
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,6 +83,28 @@ export function generateBranchConfig(
|
||||||
const toVersions: string[] = [];
|
const toVersions: string[] = [];
|
||||||
const toValues = new Set<string>();
|
const toValues = new Set<string>();
|
||||||
for (const upg of branchUpgrades) {
|
for (const upg of branchUpgrades) {
|
||||||
|
if (upg.currentDigest) {
|
||||||
|
upg.currentDigestShort =
|
||||||
|
upg.currentDigestShort ??
|
||||||
|
upg.currentDigest.replace('sha256:', '').substring(0, 7);
|
||||||
|
}
|
||||||
|
if (upg.newDigest) {
|
||||||
|
upg.newDigestShort =
|
||||||
|
upg.newDigestShort ||
|
||||||
|
upg.newDigest.replace('sha256:', '').substring(0, 7);
|
||||||
|
}
|
||||||
|
if (upg.isDigest || upg.isPinDigest) {
|
||||||
|
upg.displayFrom = upg.currentDigestShort;
|
||||||
|
upg.displayTo = upg.newDigestShort;
|
||||||
|
} else if (upg.isLockfileUpdate) {
|
||||||
|
upg.displayFrom = upg.currentVersion;
|
||||||
|
upg.displayTo = upg.newVersion;
|
||||||
|
} else if (!upg.isLockFileMaintenance) {
|
||||||
|
upg.displayFrom = upg.currentValue;
|
||||||
|
upg.displayTo = upg.newValue;
|
||||||
|
}
|
||||||
|
upg.displayFrom ??= '';
|
||||||
|
upg.displayTo ??= '';
|
||||||
if (!depNames.includes(upg.depName!)) {
|
if (!depNames.includes(upg.depName!)) {
|
||||||
depNames.push(upg.depName!);
|
depNames.push(upg.depName!);
|
||||||
}
|
}
|
||||||
|
@ -123,28 +145,6 @@ export function generateBranchConfig(
|
||||||
upgrade.commitMessageExtra = `to v${toVersions[0]}`;
|
upgrade.commitMessageExtra = `to v${toVersions[0]}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (upgrade.currentDigest) {
|
|
||||||
upgrade.currentDigestShort =
|
|
||||||
upgrade.currentDigestShort ??
|
|
||||||
upgrade.currentDigest.replace('sha256:', '').substring(0, 7);
|
|
||||||
}
|
|
||||||
if (upgrade.newDigest) {
|
|
||||||
upgrade.newDigestShort =
|
|
||||||
upgrade.newDigestShort ||
|
|
||||||
upgrade.newDigest.replace('sha256:', '').substring(0, 7);
|
|
||||||
}
|
|
||||||
if (upgrade.isDigest || upgrade.isPinDigest) {
|
|
||||||
upgrade.displayFrom = upgrade.currentDigestShort;
|
|
||||||
upgrade.displayTo = upgrade.newDigestShort;
|
|
||||||
} else if (upgrade.isLockfileUpdate) {
|
|
||||||
upgrade.displayFrom = upgrade.currentVersion;
|
|
||||||
upgrade.displayTo = upgrade.newVersion;
|
|
||||||
} else if (!upgrade.isLockFileMaintenance) {
|
|
||||||
upgrade.displayFrom = upgrade.currentValue;
|
|
||||||
upgrade.displayTo = upgrade.newValue;
|
|
||||||
}
|
|
||||||
upgrade.displayFrom ??= '';
|
|
||||||
upgrade.displayTo ??= '';
|
|
||||||
const pendingVersionsLength = upgrade.pendingVersions?.length;
|
const pendingVersionsLength = upgrade.pendingVersions?.length;
|
||||||
if (pendingVersionsLength) {
|
if (pendingVersionsLength) {
|
||||||
upgrade.displayPending = `\`${upgrade
|
upgrade.displayPending = `\`${upgrade
|
||||||
|
|
Loading…
Reference in a new issue