From 148a7921422370ea90d31816724a3adeb73477b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Goetz?= Date: Tue, 31 Aug 2021 16:34:26 +0200 Subject: [PATCH] revert postUpdateOptions related options --- lib/config/types.ts | 2 +- lib/workers/branch/reuse.spec.ts | 11 ----------- lib/workers/branch/reuse.ts | 18 ++---------------- 3 files changed, 3 insertions(+), 28 deletions(-) diff --git a/lib/config/types.ts b/lib/config/types.ts index 510e477e3262e8..459458b7200bfa 100644 --- a/lib/config/types.ts +++ b/lib/config/types.ts @@ -44,7 +44,6 @@ export interface RenovateSharedConfig { hashedBranchLength?: number; npmrc?: string; platform?: string; - postUpdateOptions?: string[]; postUpgradeTasks?: PostUpgradeTasks; prBodyColumns?: string[]; prBodyDefinitions?: Record; @@ -187,6 +186,7 @@ export interface RenovateConfig dependencyDashboardLabels?: string[]; packageFile?: string; packageRules?: PackageRule[]; + postUpdateOptions?: string[]; prConcurrentLimit?: number; prHourlyLimit?: number; diff --git a/lib/workers/branch/reuse.spec.ts b/lib/workers/branch/reuse.spec.ts index e45a2bdbb8401d..b860bbf8f90c5e 100644 --- a/lib/workers/branch/reuse.spec.ts +++ b/lib/workers/branch/reuse.spec.ts @@ -88,17 +88,6 @@ describe('workers/branch/reuse', () => { expect(res.reuseExistingBranch).toBe(true); }); - it('returns false if does not need rebasing but has postUpdateOptions', async () => { - config.postUpdateOptions = ['yarnDedupeFewer']; - git.branchExists.mockReturnValueOnce(true); - platform.getBranchPr.mockResolvedValueOnce({ - ...pr, - isConflicted: false, - }); - const res = await shouldReuseExistingBranch(config); - expect(res.reuseExistingBranch).toBe(false); - }); - it('returns true if unmergeable and cannot rebase', async () => { git.branchExists.mockReturnValueOnce(true); platform.getBranchPr.mockResolvedValueOnce({ diff --git a/lib/workers/branch/reuse.ts b/lib/workers/branch/reuse.ts index 5b8124f0bd84ad..b8bfccc71ec295 100644 --- a/lib/workers/branch/reuse.ts +++ b/lib/workers/branch/reuse.ts @@ -1,9 +1,9 @@ import { getGlobalConfig } from '../../config/global'; +import type { RenovateConfig } from '../../config/types'; import { logger } from '../../logger'; import { platform } from '../../platform'; import type { RangeStrategy } from '../../types'; import { branchExists, isBranchModified, isBranchStale } from '../../util/git'; -import type { BranchConfig } from '../types'; type ParentBranch = { reuseExistingBranch: boolean; @@ -11,7 +11,7 @@ type ParentBranch = { }; export async function shouldReuseExistingBranch( - config: BranchConfig + config: RenovateConfig ): Promise { const { branchName } = config; // Check if branch exists @@ -113,19 +113,5 @@ export async function shouldReuseExistingBranch( } } - // Branches can get in an inconsistent state if postUpdateOptions is used. - // package.json updates are run conditionally, but postUpdateOptions are run everytime - // On the first execution, everything is executed, but if on a second execution the package.json modification is - // skipped but the postUpdateOptions is executed, the lockfile will have a different result than if it was executed - // along with the changes to the package.json. Thus ending up with an incomplete branch update - // This is why we are skipping branch reuse when postUpdateOptions is used (#10050) - if (config.postUpdateOptions?.length > 0) { - logger.debug(`Branch is using postUpdateOptions`); - return { - reuseExistingBranch: false, - isModified: false, - }; - } - return { reuseExistingBranch: true, isModified: false }; }