Skip to content

Commit

Permalink
revert postUpdateOptions related options
Browse files Browse the repository at this point in the history
  • Loading branch information
onigoetz committed Aug 31, 2021
1 parent de38a32 commit 148a792
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 28 deletions.
2 changes: 1 addition & 1 deletion lib/config/types.ts
Expand Up @@ -44,7 +44,6 @@ export interface RenovateSharedConfig {
hashedBranchLength?: number;
npmrc?: string;
platform?: string;
postUpdateOptions?: string[];
postUpgradeTasks?: PostUpgradeTasks;
prBodyColumns?: string[];
prBodyDefinitions?: Record<string, string>;
Expand Down Expand Up @@ -187,6 +186,7 @@ export interface RenovateConfig
dependencyDashboardLabels?: string[];
packageFile?: string;
packageRules?: PackageRule[];
postUpdateOptions?: string[];
prConcurrentLimit?: number;
prHourlyLimit?: number;

Expand Down
11 changes: 0 additions & 11 deletions lib/workers/branch/reuse.spec.ts
Expand Up @@ -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({
Expand Down
18 changes: 2 additions & 16 deletions lib/workers/branch/reuse.ts
@@ -1,17 +1,17 @@
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;
isModified?: boolean;
};

export async function shouldReuseExistingBranch(
config: BranchConfig
config: RenovateConfig
): Promise<ParentBranch> {
const { branchName } = config;
// Check if branch exists
Expand Down Expand Up @@ -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 };
}

0 comments on commit 148a792

Please sign in to comment.