mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +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) {
|
if (config.gitAuthor) {
|
||||||
|
try {
|
||||||
await git.raw(['config', 'user.name', config.gitAuthor.name]);
|
await git.raw(['config', 'user.name', config.gitAuthor.name]);
|
||||||
await git.raw(['config', 'user.email', config.gitAuthor.address]);
|
await git.raw(['config', 'user.email', config.gitAuthor.address]);
|
||||||
// not supported yet
|
// not supported yet
|
||||||
await git.raw(['config', 'commit.gpgsign', 'false']);
|
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();
|
await determineBaseBranch();
|
||||||
|
|
|
@ -109,6 +109,11 @@ async function handleError(config, err) {
|
||||||
delete config.branchList; // eslint-disable-line no-param-reassign
|
delete config.branchList; // eslint-disable-line no-param-reassign
|
||||||
return err.message;
|
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') {
|
if (err.message === 'lockfile-error') {
|
||||||
delete config.branchList; // eslint-disable-line no-param-reassign
|
delete config.branchList; // eslint-disable-line no-param-reassign
|
||||||
logger.info('Lock file error - aborting');
|
logger.info('Lock file error - aborting');
|
||||||
|
@ -119,6 +124,5 @@ async function handleError(config, err) {
|
||||||
logger.error({ err }, `Repository has unknown error`);
|
logger.error({ err }, `Repository has unknown error`);
|
||||||
// delete branchList to avoid cleaning up branches
|
// delete branchList to avoid cleaning up branches
|
||||||
delete config.branchList; // eslint-disable-line no-param-reassign
|
delete config.branchList; // eslint-disable-line no-param-reassign
|
||||||
logger.info({ err, message: err.message }, 'Unknown error');
|
|
||||||
return 'unknown-error';
|
return 'unknown-error';
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ describe('workers/repository/error', () => {
|
||||||
'cannot-fork',
|
'cannot-fork',
|
||||||
'integration-unauthorized',
|
'integration-unauthorized',
|
||||||
'authentication-error',
|
'authentication-error',
|
||||||
|
'temporary-error',
|
||||||
];
|
];
|
||||||
errors.forEach(err => {
|
errors.forEach(err => {
|
||||||
it(`errors ${err}`, async () => {
|
it(`errors ${err}`, async () => {
|
||||||
|
|
Loading…
Reference in a new issue