renovate/lib/workers/global.js
Rhys Arkins c459ba66d6 Fix rebasing logic (#372)
* Add debug messages to API

* Fix rebase logic

* Fix tests

* Simplify logic

* Update branch.spec.js
2017-06-28 13:20:31 +02:00

39 lines
1.3 KiB
JavaScript

const logger = require('../helpers/logger');
const configParser = require('../config');
const repositoryWorker = require('./repository');
module.exports = {
start,
getRepositoryConfig,
};
async function start() {
try {
const config = await configParser.parseConfigs(process.env, process.argv);
// Iterate through repositories sequentially
for (let index = 0; index < config.repositories.length; index += 1) {
const repoConfig = module.exports.getRepositoryConfig(config, index);
repoConfig.logger.info('Renovating repository');
await repositoryWorker.renovateRepository(repoConfig);
repoConfig.logger.info('Finished repository');
}
logger.info('Renovate finished');
} catch (err) {
logger.fatal(`Renovate fatal error: ${err.message}`);
logger.error(err);
}
}
function getRepositoryConfig(globalConfig, index) {
let repository = globalConfig.repositories[index];
if (typeof repository === 'string') {
repository = { repository };
}
const repoConfig = Object.assign({}, globalConfig, repository);
repoConfig.logger = logger.child({
repository: repoConfig.repository,
});
repoConfig.isGitHub = repoConfig.platform === 'github';
repoConfig.isGitLab = repoConfig.platform === 'gitlab';
return configParser.filterConfig(repoConfig, 'repository');
}