Skip to content

Commit

Permalink
[codeowners] Filter kibanamachine (elastic#199404)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
2 people authored and CAWilson94 committed Nov 18, 2024
1 parent 08b17d2 commit dd5948d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/kbn-code-owners/src/file_code_owner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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+/);
Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-lint-packages-cli/migrate_plugins_to_package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 [];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down

0 comments on commit dd5948d

Please sign in to comment.