From db4dc1a3ba68da0981559b6f971bb6236b9a813a Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Sat, 26 Jan 2019 15:33:12 +0100
Subject: [PATCH] =?UTF-8?q?fix(bundler):=20don=E2=80=99t=20attempt=20faile?=
 =?UTF-8?q?d=20lock=20files=20generation=20repeatedly?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/manager/bundler/artifacts.js | 15 +++++++++++++++
 lib/workers/branch/index.js      | 14 ++++++--------
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/lib/manager/bundler/artifacts.js b/lib/manager/bundler/artifacts.js
index 998db43eae..b8f09b3c4b 100644
--- a/lib/manager/bundler/artifacts.js
+++ b/lib/manager/bundler/artifacts.js
@@ -23,6 +23,11 @@ async function getArtifacts(
   config
 ) {
   logger.debug(`bundler.getArtifacts(${packageFileName})`);
+  // istanbul ignore if
+  if (global.repoCache.bundlerArtifactsError) {
+    logger.info('Aborting Bundler artifacts due to previous failed attempt');
+    throw new Error(global.repoCache.bundlerArtifactsError);
+  }
   const lockFileName = packageFileName + '.lock';
   const existingLockFileContent = await platform.getFile(lockFileName);
   if (!existingLockFileContent) {
@@ -152,12 +157,22 @@ async function getArtifacts(
       err.stdout.includes('No such file or directory') &&
       !config.gitFs
     ) {
+      logger.warn(
+        { err },
+        'It is necessary to run Renovate in gitFs mode - contact your bot administrator'
+      );
+      global.repoCache.bundlerArtifactsError = 'bundler-fs';
       throw new Error('bundler-fs');
     }
     if (
       err.stdout &&
       err.stdout.includes('Please supply credentials for this source')
     ) {
+      logger.warn(
+        { err },
+        'Gemfile.lock update failed due to missing credentials'
+      );
+      global.repoCache.bundlerArtifactsError = 'bundler-credentials';
       throw new Error('bundler-credentials');
     }
     logger.info(
diff --git a/lib/workers/branch/index.js b/lib/workers/branch/index.js
index cbd4e0b5d7..c0a941241b 100644
--- a/lib/workers/branch/index.js
+++ b/lib/workers/branch/index.js
@@ -323,14 +323,12 @@ async function processBranch(branchConfig, prHourlyLimitReached, packageFiles) {
     }
     if (err.message === 'update-failure') {
       logger.warn('Error updating branch: update failure');
-    } else if (err.message === 'bundler-fs') {
-      logger.warn(
-        'It is necessary to run Renovate in gitFs mode - contact your bot administrator'
-      );
-    } else if (err.message === 'bundler-credentials') {
-      logger.warn(
-        'Bundler credentials are necessary in order to generate Gemfile.lock updates'
-      );
+    } else if (
+      err.message === 'bundler-fs' ||
+      err.message === 'bundler-credentials'
+    ) {
+      // we have already warned, so just return
+      return 'error';
     } else if (err.message === 'bundler-unknown') {
       logger.warn('Unknown bundler error');
     } else if (
-- 
GitLab