mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +00:00
parent
f6980b51f2
commit
8666835bc8
3 changed files with 30 additions and 8 deletions
|
@ -163,7 +163,11 @@ async function initRepo(repoName, token, endpoint, repoLogger) {
|
||||||
logger.debug('Could not find allowed merge methods for repo');
|
logger.debug('Could not find allowed merge methods for repo');
|
||||||
}
|
}
|
||||||
} catch (err) /* istanbul ignore next */ {
|
} catch (err) /* istanbul ignore next */ {
|
||||||
logger.error(`GitHub init error: ${JSON.stringify(err)}`);
|
if (err.statusCode === 409) {
|
||||||
|
logger.debug('Repository is not initiated');
|
||||||
|
throw new Error('uninitiated');
|
||||||
|
}
|
||||||
|
logger.error('Unknown GitHub initRepo error');
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
|
|
|
@ -94,9 +94,14 @@ async function renovateRepository(repoConfig, token) {
|
||||||
branchList = ['renovate/configure'];
|
branchList = ['renovate/configure'];
|
||||||
}
|
}
|
||||||
await cleanup.pruneStaleBranches(config, branchList);
|
await cleanup.pruneStaleBranches(config, branchList);
|
||||||
} catch (error) {
|
} catch (err) {
|
||||||
|
console.log(JSON.stringify(err));
|
||||||
// Swallow this error so that other repositories can be processed
|
// Swallow this error so that other repositories can be processed
|
||||||
config.logger.error(`Failed to process repository: ${error.message}`);
|
if (err.message === 'uninitiated') {
|
||||||
config.logger.debug({ error });
|
config.logger.info('Repository is unitiated - skipping');
|
||||||
|
} else {
|
||||||
|
config.logger.error(`Failed to process repository: ${err.message}`);
|
||||||
|
config.logger.debug({ err });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,14 +7,14 @@ const upgrades = require('../../../lib/workers/repository/upgrades');
|
||||||
|
|
||||||
const logger = require('../../_fixtures/logger');
|
const logger = require('../../_fixtures/logger');
|
||||||
|
|
||||||
apis.initApis = jest.fn(input => input);
|
|
||||||
apis.mergeRenovateJson = jest.fn(input => input);
|
|
||||||
apis.detectPackageFiles = jest.fn();
|
|
||||||
|
|
||||||
describe('workers/repository', () => {
|
describe('workers/repository', () => {
|
||||||
describe('renovateRepository', () => {
|
describe('renovateRepository', () => {
|
||||||
let config;
|
let config;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
jest.resetAllMocks();
|
||||||
|
apis.initApis = jest.fn(input => input);
|
||||||
|
apis.mergeRenovateJson = jest.fn(input => input);
|
||||||
|
apis.detectPackageFiles = jest.fn();
|
||||||
onboarding.getOnboardingStatus = jest.fn();
|
onboarding.getOnboardingStatus = jest.fn();
|
||||||
onboarding.ensurePr = jest.fn();
|
onboarding.ensurePr = jest.fn();
|
||||||
upgrades.determineRepoUpgrades = jest.fn(() => []);
|
upgrades.determineRepoUpgrades = jest.fn(() => []);
|
||||||
|
@ -140,5 +140,18 @@ describe('workers/repository', () => {
|
||||||
await repositoryWorker.renovateRepository(config);
|
await repositoryWorker.renovateRepository(config);
|
||||||
expect(config.logger.error.mock.calls.length).toBe(1);
|
expect(config.logger.error.mock.calls.length).toBe(1);
|
||||||
});
|
});
|
||||||
|
it('handles special uninitiated error', async () => {
|
||||||
|
apis.initApis.mockImplementationOnce(() => {
|
||||||
|
// Create a new object, that prototypically inherits from the Error constructor
|
||||||
|
function MyError() {
|
||||||
|
this.message = 'uninitiated';
|
||||||
|
}
|
||||||
|
MyError.prototype = Object.create(Error.prototype);
|
||||||
|
MyError.prototype.constructor = MyError;
|
||||||
|
throw new MyError();
|
||||||
|
});
|
||||||
|
await repositoryWorker.renovateRepository(config);
|
||||||
|
expect(config.logger.error.mock.calls.length).toBe(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue