Skip to content

Commit

Permalink
[8.15] [codeowners] Filter kibanamachine (#199404) (#199862)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.15`:
- [[codeowners] Filter kibanamachine
(#199404)](#199404)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Jon","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-12T18:39:17Z","message":"[codeowners]
Filter kibanamachine (#199404)\n\nCurrently we remove CODEOWNERS on
backport branches to avoid review\r\nassignments: reviews were already
collected on the source pull request.\r\nIf there's a conflict, it will
go through another round of review but\r\nnot require all the original
assignees.\r\n\r\nWe want to re-add the file for our own tooling, and to
avoid CODEOWNERS\r\nmerge conflicts on backports. To do this, we're
going to add a global\r\noverride to code assignments on backport
branches.\r\n\r\nThis updates our CODEOWNERS libraries to ignore
assignments
to\r\n`kibanamachine`.\r\n\r\n---------\r\n\r\nCo-authored-by: Dzmitry
Lemechko
<[email protected]>","sha":"a26f5d8b61b19aeeae741a7f750257e692edd430","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Operations","release_note:skip","v9.0.0","backport:all-open"],"title":"[codeowners]
Filter
kibanamachine","number":199404,"url":"https://github.com/elastic/kibana/pull/199404","mergeCommit":{"message":"[codeowners]
Filter kibanamachine (#199404)\n\nCurrently we remove CODEOWNERS on
backport branches to avoid review\r\nassignments: reviews were already
collected on the source pull request.\r\nIf there's a conflict, it will
go through another round of review but\r\nnot require all the original
assignees.\r\n\r\nWe want to re-add the file for our own tooling, and to
avoid CODEOWNERS\r\nmerge conflicts on backports. To do this, we're
going to add a global\r\noverride to code assignments on backport
branches.\r\n\r\nThis updates our CODEOWNERS libraries to ignore
assignments
to\r\n`kibanamachine`.\r\n\r\n---------\r\n\r\nCo-authored-by: Dzmitry
Lemechko
<[email protected]>","sha":"a26f5d8b61b19aeeae741a7f750257e692edd430"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/199404","number":199404,"mergeCommit":{"message":"[codeowners]
Filter kibanamachine (#199404)\n\nCurrently we remove CODEOWNERS on
backport branches to avoid review\r\nassignments: reviews were already
collected on the source pull request.\r\nIf there's a conflict, it will
go through another round of review but\r\nnot require all the original
assignees.\r\n\r\nWe want to re-add the file for our own tooling, and to
avoid CODEOWNERS\r\nmerge conflicts on backports. To do this, we're
going to add a global\r\noverride to code assignments on backport
branches.\r\n\r\nThis updates our CODEOWNERS libraries to ignore
assignments
to\r\n`kibanamachine`.\r\n\r\n---------\r\n\r\nCo-authored-by: Dzmitry
Lemechko
<[email protected]>","sha":"a26f5d8b61b19aeeae741a7f750257e692edd430"}}]}]
BACKPORT-->

Co-authored-by: Jon <[email protected]>
  • Loading branch information
kibanamachine and jbudz authored Nov 12, 2024
1 parent 8b942bb commit db3a17c
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 @@ -35,7 +35,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 @@ -77,7 +77,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 @@ -12,8 +12,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 db3a17c

Please sign in to comment.