[codeowners] Filter kibanamachine (#199404)

Currently we remove CODEOWNERS on backport branches to avoid review
assignments: reviews were already collected on the source pull request.
If there's a conflict, it will go through another round of review but
not require all the original assignees.

We want to re-add the file for our own tooling, and to avoid CODEOWNERS
merge conflicts on backports. To do this, we're going to add a global
override to code assignments on backport branches.

This updates our CODEOWNERS libraries to ignore assignments to
`kibanamachine`.

---------

Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
This commit is contained in:
Jon 2024-11-12 12:39:17 -06:00 committed by GitHub
parent 61cc4129a3
commit a26f5d8b61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 4 deletions

View file

@ -39,7 +39,9 @@ export function getPathsWithOwnersReversed(): PathWithOwners[] {
const codeownersLines = codeownersContent.split(/\r?\n/);
const codeowners = codeownersLines
.map((line) => line.trim())
.filter((line) => line && line[0] !== '#');
.filter((line) => line && line[0] !== '#')
// kibanamachine is an assignment override on backport branches to avoid review requests
.filter((line) => line && !line.includes('@kibanamachine'));
const pathsWithOwners: PathWithOwners[] = codeowners.map((c) => {
const [path, ...ghTeams] = c.split(/\s+/);

View file

@ -78,7 +78,8 @@ export async function migratePluginsToPackages(legacyManifests: RepoPath[]) {
.split('\n')
.flatMap((line) => {
const trim = line.trim();
if (!trim || trim.startsWith('#')) {
// kibanamachine is an assignment override on backport branches to avoid review requests
if (!trim || trim.startsWith('#') || trim.includes('@kibanamachine')) {
return [];
}

View file

@ -13,8 +13,9 @@ import { pipe } from '../utils';
const allLines$ = (lineReader) =>
fromEvent(lineReader, 'line').pipe(
filter(function dropEmptiesAndDropComments(x) {
return x !== '' && !/^#\s{1,3}/.test(x);
filter(function dropEmptiesAndDropCommentsAndDropKibanamachine(x) {
// kibanamachine is an assignment override on backport branches to avoid review requests
return x !== '' && !/^#\s{1,3}/.test(x) && !x.includes('@kibanamachine');
}),
map(pipe(dropCCDelim, pathAndTeams)),
takeUntil(fromEvent(lineReader, 'close'))