kibana/tasks/reject_rej_files.js
Court Ewing 55e429cc4f [internal] Reject CI builds if any .rej files exist
.rej are the byproduct of failed patches via git-apply or artifacts of
the backporting process through jasper. Any build that has them should
be rejected early.
2016-03-29 13:24:32 -04:00

31 lines
859 B
JavaScript

import { startsWith } from 'lodash';
// Fails if any .rej files are found
// .rej files are an artifact from a failed git-apply or a jasper backport
// This check is intentionally performed on the files in the repo rather than
// on the files that are to be committed.
export default grunt => {
grunt.registerTask('rejectRejFiles', 'Reject any git-apply .rej files', () => {
const ignoredTopLevelDirs = [
'esvm',
'installedPlugins',
'node_modules',
'optimize'
];
const matchBase = true;
const filter = file => (
ignoredTopLevelDirs.every(dir => !startsWith(file, dir))
);
const files = grunt.file.expand({ filter, matchBase }, '*.rej');
if (files.length > 0) {
const err = `.rej files are not allowed:\n${files.join('\n')}`;
grunt.log.error(err);
return false;
}
});
};