mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +00:00
fix(gitFs): gracefully handle git config failure
This commit is contained in:
parent
e8509cf9bc
commit
d8614aa785
3 changed files with 15 additions and 5 deletions
|
@ -115,10 +115,15 @@ class Storage {
|
|||
}
|
||||
|
||||
if (config.gitAuthor) {
|
||||
await git.raw(['config', 'user.name', config.gitAuthor.name]);
|
||||
await git.raw(['config', 'user.email', config.gitAuthor.address]);
|
||||
// not supported yet
|
||||
await git.raw(['config', 'commit.gpgsign', 'false']);
|
||||
try {
|
||||
await git.raw(['config', 'user.name', config.gitAuthor.name]);
|
||||
await git.raw(['config', 'user.email', config.gitAuthor.address]);
|
||||
// not supported yet
|
||||
await git.raw(['config', 'commit.gpgsign', 'false']);
|
||||
} catch (err) /* istanbul ignore next */ {
|
||||
logger.debug({ err }, 'Error setting git config');
|
||||
throw new Error('temporary-error');
|
||||
}
|
||||
}
|
||||
|
||||
await determineBaseBranch();
|
||||
|
|
|
@ -109,6 +109,11 @@ async function handleError(config, err) {
|
|||
delete config.branchList; // eslint-disable-line no-param-reassign
|
||||
return err.message;
|
||||
}
|
||||
if (err.message === 'temporary-error') {
|
||||
logger.info('Temporary 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');
|
||||
|
@ -119,6 +124,5 @@ async function handleError(config, err) {
|
|||
logger.error({ err }, `Repository has unknown error`);
|
||||
// delete branchList to avoid cleaning up branches
|
||||
delete config.branchList; // eslint-disable-line no-param-reassign
|
||||
logger.info({ err, message: err.message }, 'Unknown error');
|
||||
return 'unknown-error';
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ describe('workers/repository/error', () => {
|
|||
'cannot-fork',
|
||||
'integration-unauthorized',
|
||||
'authentication-error',
|
||||
'temporary-error',
|
||||
];
|
||||
errors.forEach(err => {
|
||||
it(`errors ${err}`, async () => {
|
||||
|
|
Loading…
Reference in a new issue