From b5965c6285e5e60a11aa9d211d638b5447757aa1 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Sat, 2 Feb 2019 02:46:32 +0100 Subject: [PATCH] fix(gitFs): gracefully handle authentication failure --- lib/workers/branch/index.js | 5 +++++ lib/workers/repository/error.js | 5 +++++ test/workers/repository/error.spec.js | 1 + 3 files changed, 11 insertions(+) diff --git a/lib/workers/branch/index.js b/lib/workers/branch/index.js index c0a941241b..206fa5d2c7 100644 --- a/lib/workers/branch/index.js +++ b/lib/workers/branch/index.js @@ -331,6 +331,11 @@ async function processBranch(branchConfig, prHourlyLimitReached, packageFiles) { return 'error'; } else if (err.message === 'bundler-unknown') { logger.warn('Unknown bundler error'); + } else if ( + err.messagee && + err.message.includes('fatal: Authentication failed') + ) { + throw new Error('authentication-failure'); } else if ( err.message !== 'registry-failure' && err.message !== 'platform-failure' diff --git a/lib/workers/repository/error.js b/lib/workers/repository/error.js index f2c726c50b..5acd918b84 100644 --- a/lib/workers/repository/error.js +++ b/lib/workers/repository/error.js @@ -99,6 +99,11 @@ async function handleError(config, err) { delete config.branchList; // eslint-disable-line no-param-reassign return err.message; } + if (err.message === 'authentication-error') { + logger.warn('Authentication error - aborting'); + delete config.branchList; // eslint-disable-line no-param-reassign + return err.message; + } if (err.message === 'lockfile-error') { delete config.branchList; // eslint-disable-line no-param-reassign logger.info('Lock file error - aborting'); diff --git a/test/workers/repository/error.spec.js b/test/workers/repository/error.spec.js index 3cc00d5a47..b37d4362d6 100644 --- a/test/workers/repository/error.spec.js +++ b/test/workers/repository/error.spec.js @@ -31,6 +31,7 @@ describe('workers/repository/error', () => { 'no-vulnerability-alerts', 'cannot-fork', 'integration-unauthorized', + 'authentication-error', ]; errors.forEach(err => { it(`errors ${err}`, async () => { -- GitLab