From 6f54f09aa2db8c5bfd06b22f9d729517cccfc7ff Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Sun, 18 Apr 2021 17:27:41 +0200
Subject: [PATCH] =?UTF-8?q?feat:=20don=E2=80=99t=20block=20updates=20due?=
 =?UTF-8?q?=20to=20pinning=20(#9600)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/config/definitions.ts                         |  1 -
 lib/manager/types.ts                              |  1 -
 .../lookup/__snapshots__/index.spec.ts.snap       | 15 ---------------
 lib/workers/repository/process/lookup/index.ts    | 11 -----------
 lib/workers/repository/process/write.spec.ts      | 11 -----------
 lib/workers/repository/process/write.ts           | 10 +---------
 .../updates/__snapshots__/generate.spec.ts.snap   |  4 ----
 lib/workers/repository/updates/generate.ts        |  3 ---
 8 files changed, 1 insertion(+), 55 deletions(-)

diff --git a/lib/config/definitions.ts b/lib/config/definitions.ts
index ca38c2efc1..ecc1d455c5 100644
--- a/lib/config/definitions.ts
+++ b/lib/config/definitions.ts
@@ -1082,7 +1082,6 @@ const options: RenovateOptions[] = [
     stage: 'package',
     type: 'object',
     default: {
-      recreateClosed: true,
       rebaseWhen: 'behind-base-branch',
       groupName: 'Pin Dependencies',
       groupSlug: 'pin-dependencies',
diff --git a/lib/manager/types.ts b/lib/manager/types.ts
index b845b030f1..933d8729f4 100644
--- a/lib/manager/types.ts
+++ b/lib/manager/types.ts
@@ -135,7 +135,6 @@ export interface Package<T> extends ManagerData<T> {
 
 export interface LookupUpdate {
   bucket?: string;
-  blockedByPin?: boolean;
   branchName?: string;
   commitMessageAction?: string;
   isBump?: boolean;
diff --git a/lib/workers/repository/process/lookup/__snapshots__/index.spec.ts.snap b/lib/workers/repository/process/lookup/__snapshots__/index.spec.ts.snap
index f4483d0cff..a98ec30cf6 100644
--- a/lib/workers/repository/process/lookup/__snapshots__/index.spec.ts.snap
+++ b/lib/workers/repository/process/lookup/__snapshots__/index.spec.ts.snap
@@ -9,7 +9,6 @@ Array [
     "updateType": "pin",
   },
   Object {
-    "blockedByPin": true,
     "bucket": "latest",
     "newMajor": 1,
     "newMinor": 4,
@@ -94,7 +93,6 @@ Array [
     "updateType": "pin",
   },
   Object {
-    "blockedByPin": true,
     "bucket": "non-major",
     "isRange": true,
     "newMajor": 0,
@@ -109,7 +107,6 @@ Array [
     "updateType": "minor",
   },
   Object {
-    "blockedByPin": true,
     "bucket": "major",
     "isRange": true,
     "newMajor": 1,
@@ -144,7 +141,6 @@ Object {
   "sourceUrl": "https://github.com/nodejs/node",
   "updates": Array [
     Object {
-      "blockedByPin": true,
       "bucket": "non-major",
       "newDigest": "sha256:abcdef1234567890",
       "newMajor": 8,
@@ -331,7 +327,6 @@ Array [
     "updateType": "pin",
   },
   Object {
-    "blockedByPin": true,
     "bucket": "major",
     "newMajor": 1,
     "newMinor": 4,
@@ -563,7 +558,6 @@ Array [
     "updateType": "pin",
   },
   Object {
-    "blockedByPin": true,
     "bucket": "non-major",
     "newMajor": 0,
     "newMinor": 9,
@@ -603,7 +597,6 @@ Array [
     "updateType": "minor",
   },
   Object {
-    "blockedByPin": true,
     "bucket": "major",
     "newMajor": 1,
     "newMinor": 4,
@@ -1614,7 +1607,6 @@ Array [
     "updateType": "pin",
   },
   Object {
-    "blockedByPin": true,
     "bucket": "non-major",
     "newMajor": 0,
     "newMinor": 9,
@@ -1654,7 +1646,6 @@ Array [
     "updateType": "minor",
   },
   Object {
-    "blockedByPin": true,
     "bucket": "major",
     "newMajor": 1,
     "newMinor": 4,
@@ -1686,7 +1677,6 @@ Array [
     "updateType": "pin",
   },
   Object {
-    "blockedByPin": true,
     "bucket": "non-major",
     "newMajor": 0,
     "newMinor": 9,
@@ -1726,7 +1716,6 @@ Array [
     "updateType": "minor",
   },
   Object {
-    "blockedByPin": true,
     "bucket": "major",
     "newMajor": 1,
     "newMinor": 4,
@@ -1802,7 +1791,6 @@ Array [
     "updateType": "pin",
   },
   Object {
-    "blockedByPin": true,
     "bucket": "non-major",
     "newMajor": 1,
     "newMinor": 4,
@@ -2235,7 +2223,6 @@ Array [
     "updateType": "pin",
   },
   Object {
-    "blockedByPin": true,
     "bucket": "non-major",
     "newMajor": 1,
     "newMinor": 4,
@@ -2425,7 +2412,6 @@ Array [
     "updateType": "pin",
   },
   Object {
-    "blockedByPin": true,
     "bucket": "non-major",
     "newMajor": 1,
     "newMinor": 4,
@@ -2481,7 +2467,6 @@ Array [
     "updateType": "pin",
   },
   Object {
-    "blockedByPin": true,
     "bucket": "non-major",
     "newMajor": 1,
     "newMinor": 4,
diff --git a/lib/workers/repository/process/lookup/index.ts b/lib/workers/repository/process/lookup/index.ts
index 368819fde4..66e221f224 100644
--- a/lib/workers/repository/process/lookup/index.ts
+++ b/lib/workers/repository/process/lookup/index.ts
@@ -343,16 +343,5 @@ export async function lookupUpdates(
         update.isLockfileUpdate ||
         (update.newDigest && !update.newDigest.startsWith(currentDigest))
     );
-  if (res.updates.some((update) => update.updateType === 'pin')) {
-    for (const update of res.updates) {
-      if (
-        update.updateType !== 'pin' &&
-        update.updateType !== 'rollback' &&
-        !isVulnerabilityAlert
-      ) {
-        update.blockedByPin = true;
-      }
-    }
-  }
   return res;
 }
diff --git a/lib/workers/repository/process/write.spec.ts b/lib/workers/repository/process/write.spec.ts
index 4d172bd1d9..a8c5fcd96d 100644
--- a/lib/workers/repository/process/write.spec.ts
+++ b/lib/workers/repository/process/write.spec.ts
@@ -29,17 +29,6 @@ beforeEach(() => {
 
 describe(getName(__filename), () => {
   describe('writeUpdates()', () => {
-    it('skips branches blocked by pin', async () => {
-      const branches: BranchConfig[] = [
-        { updateType: 'pin' },
-        { blockedByPin: true },
-        {},
-      ] as never;
-      git.branchExists.mockReturnValueOnce(false);
-      const res = await writeUpdates(config, branches);
-      expect(res).toEqual('done');
-      expect(branchWorker.processBranch).toHaveBeenCalledTimes(2);
-    });
     it('stops after automerge', async () => {
       const branches: BranchConfig[] = [
         {},
diff --git a/lib/workers/repository/process/write.ts b/lib/workers/repository/process/write.ts
index 7fe130b458..ca087fda93 100644
--- a/lib/workers/repository/process/write.ts
+++ b/lib/workers/repository/process/write.ts
@@ -12,7 +12,7 @@ export async function writeUpdates(
   config: RenovateConfig,
   allBranches: BranchConfig[]
 ): Promise<WriteUpdateResult> {
-  let branches = allBranches;
+  const branches = allBranches;
   logger.debug(
     `Processing ${branches.length} branch${
       branches.length === 1 ? '' : 'es'
@@ -21,14 +21,6 @@ export async function writeUpdates(
       .sort()
       .join(', ')}`
   );
-  branches = branches.filter((branchConfig) => {
-    if (branchConfig.blockedByPin) {
-      logger.debug(`Branch ${branchConfig.branchName} is blocked by a Pin PR`);
-      return false;
-    }
-    return true;
-  });
-
   const prsRemaining = await getPrsRemaining(config, branches);
   logger.debug({ prsRemaining }, 'Calculated maximum PRs remaining this run');
   setMaxLimit(Limit.PullRequests, prsRemaining);
diff --git a/lib/workers/repository/updates/__snapshots__/generate.spec.ts.snap b/lib/workers/repository/updates/__snapshots__/generate.spec.ts.snap
index e187171a02..7d31281a2b 100644
--- a/lib/workers/repository/updates/__snapshots__/generate.spec.ts.snap
+++ b/lib/workers/repository/updates/__snapshots__/generate.spec.ts.snap
@@ -6,7 +6,6 @@ exports[`workers/repository/updates/generate generateBranchConfig() handles @typ
 Object {
   "addLabels": Array [],
   "automerge": false,
-  "blockedByPin": false,
   "branchName": "some-branch",
   "commitMessage": "",
   "constraints": Object {},
@@ -77,7 +76,6 @@ exports[`workers/repository/updates/generate generateBranchConfig() handles @typ
 Object {
   "addLabels": Array [],
   "automerge": false,
-  "blockedByPin": false,
   "branchName": "some-branch",
   "commitBodyTable": true,
   "commitMessage": "\\n\\n| datasource | package         | from  | to    |\\n| ---------- | --------------- | ----- | ----- |\\n| npm        | @types/some-dep | 0.5.7 | 0.5.8 |\\n",
@@ -149,7 +147,6 @@ exports[`workers/repository/updates/generate generateBranchConfig() handles lock
 Object {
   "addLabels": Array [],
   "automerge": false,
-  "blockedByPin": false,
   "branchName": "some-branch",
   "commitMessage": "",
   "constraints": Object {},
@@ -181,7 +178,6 @@ exports[`workers/repository/updates/generate generateBranchConfig() handles lock
 Object {
   "addLabels": Array [],
   "automerge": false,
-  "blockedByPin": false,
   "branchName": "some-branch",
   "commitMessage": "",
   "constraints": Object {},
diff --git a/lib/workers/repository/updates/generate.ts b/lib/workers/repository/updates/generate.ts
index a7f18d194d..2ddf9b39bc 100644
--- a/lib/workers/repository/updates/generate.ts
+++ b/lib/workers/repository/updates/generate.ts
@@ -302,9 +302,6 @@ export function generateBranchConfig(
   if (config.upgrades.some((upgrade) => upgrade.updateType === 'major')) {
     config.updateType = 'major';
   }
-  config.blockedByPin = config.upgrades.every(
-    (upgrade) => upgrade.blockedByPin
-  );
   config.constraints = {};
   for (const upgrade of config.upgrades || []) {
     if (upgrade.constraints) {
-- 
GitLab