diff --git a/OWNERS_ALIASES b/OWNERS_ALIASES new file mode 100644 index 000000000000..c1cb02e5500c --- /dev/null +++ b/OWNERS_ALIASES @@ -0,0 +1,37 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# See the OWNERS_ALIASES docs: https://git.k8s.io/community/contributors/guide/owners.md#owners_aliases + +aliases: + cluster-api-admins: + - justinsb + - krousey + - luxas + - roberthbailey + - kris-nova + cluster-api-aws-maintainers: + - detiber + - chuckha + - davidewatson + - d-nishi + - enxebre + - ingvagabund + cluster-api-maintainers: + - jessicaochen + - k4leung4 + - karan + - kris-nova + - krousey + - medinatiger + - mkjelland + - roberthbailey + - rsdcastro + - spew + sig-aws-leads: + - justinsb + - kris-nova + - countspongebob + sig-cluster-lifecycle-leads: + - lukemarsden + - luxas + - roberthbailey + - timothysc diff --git a/ci-operator/jobs/kubernetes-incubator/cri-o/OWNERS b/ci-operator/jobs/kubernetes-incubator/cri-o/OWNERS index 6b945bbaff32..e6c03d9bdd7f 100644 --- a/ci-operator/jobs/kubernetes-incubator/cri-o/OWNERS +++ b/ci-operator/jobs/kubernetes-incubator/cri-o/OWNERS @@ -1,9 +1,13 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/kubernetes-incubator/cri-o/blob/3fc75c50160907073e161d78fc51a5ed5dad8313/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - - mrunalp - - runcom - - cyphar - - mikebrow - - feiskyer - - sameo - - rhatdan - - nalind +- mrunalp +- runcom +- cyphar +- mikebrow +- feiskyer +- sameo +- rhatdan +- nalind diff --git a/ci-operator/jobs/kubernetes-incubator/descheduler/OWNERS b/ci-operator/jobs/kubernetes-incubator/descheduler/OWNERS index 4d499586509b..ab6edf639619 100644 --- a/ci-operator/jobs/kubernetes-incubator/descheduler/OWNERS +++ b/ci-operator/jobs/kubernetes-incubator/descheduler/OWNERS @@ -1,3 +1,7 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/kubernetes-incubator/descheduler/blob/40ca53e0a59ab1fafb86e316c451ac4ff0664095/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - aveshagarwal - ravisantoshgudimetla diff --git a/ci-operator/jobs/openshift-s2i/s2i-wildfly/OWNERS b/ci-operator/jobs/openshift-s2i/s2i-wildfly/OWNERS index 5796d1b0e8ed..b42b6396aa70 100644 --- a/ci-operator/jobs/openshift-s2i/s2i-wildfly/OWNERS +++ b/ci-operator/jobs/openshift-s2i/s2i-wildfly/OWNERS @@ -1,2 +1,6 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift-s2i/s2i-wildfly/blob/c4f8f2236c87aa6b47a15d22ea64b58ec0f48de9/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - bparees diff --git a/ci-operator/jobs/openshift/api/OWNERS b/ci-operator/jobs/openshift/api/OWNERS index 6496c8f9dafd..dbf904b7a2d3 100644 --- a/ci-operator/jobs/openshift/api/OWNERS +++ b/ci-operator/jobs/openshift/api/OWNERS @@ -1,5 +1,8 @@ -reviewers: +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/api/blob/bccfa651752a8a9f963b9899b477dcffbe9be786/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - - smarterclayton - - deads2k - - liggitt +- smarterclayton +- deads2k +- liggitt diff --git a/ci-operator/jobs/openshift/autoheal/OWNERS b/ci-operator/jobs/openshift/autoheal/OWNERS index dad2af879c3a..c8c5637e7f69 100644 --- a/ci-operator/jobs/openshift/autoheal/OWNERS +++ b/ci-operator/jobs/openshift/autoheal/OWNERS @@ -1,3 +1,10 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/autoheal/blob/f2f435d1f87afe635ca93cb99e24d1626c4008c3/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + +approvers: +- jhernand +- moolitayer reviewers: - cben - elad661 @@ -8,7 +15,3 @@ reviewers: - yaacov - zeari - zgalor - -approvers: -- jhernand -- moolitayer diff --git a/ci-operator/jobs/openshift/azure-misc/OWNERS b/ci-operator/jobs/openshift/azure-misc/OWNERS index 0dfee8912216..29732778caf0 100644 --- a/ci-operator/jobs/openshift/azure-misc/OWNERS +++ b/ci-operator/jobs/openshift/azure-misc/OWNERS @@ -1,13 +1,9 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/azure-misc/blob/7d326ed11476949c1f70ff7ecaf161a3808f046e/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: -- jim-minter -- kargakis -- kwoodson -- mjudeikis - pweil- -reviewers: - jim-minter - kargakis - kwoodson -- mjudeikis -- pweil- -- thanasisk diff --git a/ci-operator/jobs/openshift/ci-ns-ttl-controller/OWNERS b/ci-operator/jobs/openshift/ci-ns-ttl-controller/OWNERS index acd2c029947f..30677f1f02a7 100644 --- a/ci-operator/jobs/openshift/ci-ns-ttl-controller/OWNERS +++ b/ci-operator/jobs/openshift/ci-ns-ttl-controller/OWNERS @@ -1,2 +1,6 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/ci-ns-ttl-controller/blob/f4373aa13466c8d3750e4c166861fbce92b93eae/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - stevekuznetsov diff --git a/ci-operator/jobs/openshift/ci-operator-prowgen/OWNERS b/ci-operator/jobs/openshift/ci-operator-prowgen/OWNERS index 28370719d26c..756e5e2bb0e4 100644 --- a/ci-operator/jobs/openshift/ci-operator-prowgen/OWNERS +++ b/ci-operator/jobs/openshift/ci-operator-prowgen/OWNERS @@ -1,2 +1,6 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/ci-operator-prowgen/blob/ca7e5db8cd812a247b1bf254f79c3f9efa5637bb/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - petr-muller diff --git a/ci-operator/jobs/openshift/ci-operator/OWNERS b/ci-operator/jobs/openshift/ci-operator/OWNERS index 3d86e4ef1e9c..3671cd7c8494 100644 --- a/ci-operator/jobs/openshift/ci-operator/OWNERS +++ b/ci-operator/jobs/openshift/ci-operator/OWNERS @@ -1,3 +1,7 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/ci-operator/blob/4504de72562a88e1b0cf3c018a5ee78164695017/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - smarterclayton - stevekuznetsov diff --git a/ci-operator/jobs/openshift/ci-vm-operator/OWNERS b/ci-operator/jobs/openshift/ci-vm-operator/OWNERS index acd2c029947f..f16c8638dd66 100644 --- a/ci-operator/jobs/openshift/ci-vm-operator/OWNERS +++ b/ci-operator/jobs/openshift/ci-vm-operator/OWNERS @@ -1,2 +1,6 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/ci-vm-operator/blob/570d71064e3d543f8ce9225c8abbb8617028cbee/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - stevekuznetsov diff --git a/ci-operator/jobs/openshift/cluster-api-provider-aws/OWNERS b/ci-operator/jobs/openshift/cluster-api-provider-aws/OWNERS index b098aa776485..12ff7e46569c 100644 --- a/ci-operator/jobs/openshift/cluster-api-provider-aws/OWNERS +++ b/ci-operator/jobs/openshift/cluster-api-provider-aws/OWNERS @@ -1,9 +1,11 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/cluster-api-provider-aws/blob/44e974de04f496f9552ecd37b73cad01b6d69f4d/OWNERS # See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md approvers: - - enxebre - - frobware - - ingvagabund - - paulfantom - - spangenberg - - trawler +- enxebre +- frobware +- ingvagabund +- paulfantom +- spangenberg +- trawler diff --git a/ci-operator/jobs/openshift/cluster-capacity/OWNERS b/ci-operator/jobs/openshift/cluster-capacity/OWNERS index 4bbdd34d6e28..3e8213981127 100644 --- a/ci-operator/jobs/openshift/cluster-capacity/OWNERS +++ b/ci-operator/jobs/openshift/cluster-capacity/OWNERS @@ -1,3 +1,7 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/cluster-capacity/blob/22be164a90dc8d2705ce05638e6ce61839596dfc/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - ingvagabund - aveshagarwal diff --git a/ci-operator/jobs/openshift/cluster-dns-operator/OWNERS b/ci-operator/jobs/openshift/cluster-dns-operator/OWNERS index aaa37f85eccc..ac92e5bbcf25 100644 --- a/ci-operator/jobs/openshift/cluster-dns-operator/OWNERS +++ b/ci-operator/jobs/openshift/cluster-dns-operator/OWNERS @@ -1,10 +1,14 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/cluster-dns-operator/blob/b8a2d7083b202501ca60aca1c81ce50f7adbbce6/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - - ironcladlou - - knobunc +- ironcladlou +- knobunc reviewers: - - ironcladlou - - knobunc - - pravisankar - - imcsk8 - - ramr - - Miciah +- ironcladlou +- knobunc +- pravisankar +- imcsk8 +- ramr +- Miciah diff --git a/ci-operator/jobs/openshift/cluster-ingress-operator/OWNERS b/ci-operator/jobs/openshift/cluster-ingress-operator/OWNERS index aaa37f85eccc..901081304fa7 100644 --- a/ci-operator/jobs/openshift/cluster-ingress-operator/OWNERS +++ b/ci-operator/jobs/openshift/cluster-ingress-operator/OWNERS @@ -1,10 +1,14 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/cluster-ingress-operator/blob/387220e8f17b04ee237d3883a0913790b59e0194/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - - ironcladlou - - knobunc +- ironcladlou +- knobunc reviewers: - - ironcladlou - - knobunc - - pravisankar - - imcsk8 - - ramr - - Miciah +- ironcladlou +- knobunc +- pravisankar +- imcsk8 +- ramr +- Miciah diff --git a/ci-operator/jobs/openshift/cluster-monitoring-operator/OWNERS b/ci-operator/jobs/openshift/cluster-monitoring-operator/OWNERS index d566dff12ffb..10e8cfdf76e1 100644 --- a/ci-operator/jobs/openshift/cluster-monitoring-operator/OWNERS +++ b/ci-operator/jobs/openshift/cluster-monitoring-operator/OWNERS @@ -1,12 +1,15 @@ -reviewers: +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/cluster-monitoring-operator/blob/2500badeddb476785f04b4a0fe6dcd375c8686fb/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + +approvers: - brancz - mxinden - elad661 - ironcladlou - squat - s-urbaniak - -approvers: +reviewers: - brancz - mxinden - elad661 diff --git a/ci-operator/jobs/openshift/cluster-samples-operator/OWNERS b/ci-operator/jobs/openshift/cluster-samples-operator/OWNERS index 18e8e6ab9c23..e8ed28726b90 100644 --- a/ci-operator/jobs/openshift/cluster-samples-operator/OWNERS +++ b/ci-operator/jobs/openshift/cluster-samples-operator/OWNERS @@ -1,3 +1,7 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/cluster-samples-operator/blob/eccdb3ca00baec2b280c2ebb12a7c56edec7f818/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - bparees - gabemontero diff --git a/ci-operator/jobs/openshift/cluster-version-operator/OWNERS b/ci-operator/jobs/openshift/cluster-version-operator/OWNERS index edeceee35511..80e5e10a1c9e 100644 --- a/ci-operator/jobs/openshift/cluster-version-operator/OWNERS +++ b/ci-operator/jobs/openshift/cluster-version-operator/OWNERS @@ -1,9 +1,11 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/cluster-version-operator/blob/7fd23584325138b3a6420cc2a9a0e253233a8637/OWNERS # See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md approvers: - - crawford - - smarterclayton - - yifan-gu +- crawford +- smarterclayton +- yifan-gu reviewers: - - abhinavdahiya - - wking +- abhinavdahiya +- wking diff --git a/ci-operator/jobs/openshift/coredns/OWNERS b/ci-operator/jobs/openshift/coredns/OWNERS index 24c52b0fc87a..897c27bea984 100644 --- a/ci-operator/jobs/openshift/coredns/OWNERS +++ b/ci-operator/jobs/openshift/coredns/OWNERS @@ -1,33 +1,25 @@ -reviewers: - - bradbeam - - chrisohaver - - fastest963 - - fturib - - greenpau - - grobie - - isolus - - johnbelamaric - - miekg - - pmoroney - - rajansandeep - - stp-ip - - superq - - varyoo - - yongtang +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/coredns/blob/5e0206e86b16837461244d0f0c5d7c19de8e1f4e/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md approvers: - - chrisohaver - - johnbelamaric - - miekg - - yongtang - -features: - - comments - - reviewers - - aliases - - branches - -aliases: - - | - /plugin: (.*) -> /label add: plugin/$1 - +- chrisohaver +- johnbelamaric +- miekg +- yongtang +reviewers: +- bradbeam +- chrisohaver +- fastest963 +- fturib +- greenpau +- grobie +- isolus +- johnbelamaric +- miekg +- pmoroney +- rajansandeep +- stp-ip +- superq +- varyoo +- yongtang diff --git a/ci-operator/jobs/openshift/descheduler/OWNERS b/ci-operator/jobs/openshift/descheduler/OWNERS index 4d499586509b..9e102ef9c938 100644 --- a/ci-operator/jobs/openshift/descheduler/OWNERS +++ b/ci-operator/jobs/openshift/descheduler/OWNERS @@ -1,3 +1,7 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/descheduler/blob/d435537acd9224cc8a3912ae8b661f3488a13a33/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - aveshagarwal - ravisantoshgudimetla diff --git a/ci-operator/jobs/openshift/image-registry/OWNERS b/ci-operator/jobs/openshift/image-registry/OWNERS index e254ff7fba15..4f5935641da3 100644 --- a/ci-operator/jobs/openshift/image-registry/OWNERS +++ b/ci-operator/jobs/openshift/image-registry/OWNERS @@ -1,16 +1,20 @@ -reviewers: - - smarterclayton - - deads2k - - liggitt - - bparees - - dmage - - legionus - - miminar +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/image-registry/blob/0d49798e519cb36d27c97392e92a9bf41ef90b66/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - - smarterclayton - - deads2k - - liggitt - - bparees - - dmage - - legionus - - miminar +- smarterclayton +- deads2k +- liggitt +- bparees +- dmage +- legionus +- miminar +reviewers: +- smarterclayton +- deads2k +- liggitt +- bparees +- dmage +- legionus +- miminar diff --git a/ci-operator/jobs/openshift/installer/OWNERS b/ci-operator/jobs/openshift/installer/OWNERS index ead2bf30b1fc..dae8bc29d096 100644 --- a/ci-operator/jobs/openshift/installer/OWNERS +++ b/ci-operator/jobs/openshift/installer/OWNERS @@ -1,11 +1,13 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/installer/blob/ae7fe33afbf0bf3b19bf77b0ce26ffb4c98cfe11/OWNERS # See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md approvers: - - aaronlevy - - abhinavdahiya - - crawford - - smarterclayton - - wking - - yifan-gu +- aaronlevy +- abhinavdahiya +- crawford +- smarterclayton +- wking +- yifan-gu reviewers: - - vikramsk +- vikramsk diff --git a/ci-operator/jobs/openshift/jenkins-client-plugin/OWNERS b/ci-operator/jobs/openshift/jenkins-client-plugin/OWNERS index fa9451a07a39..53c5c5fd3c63 100644 --- a/ci-operator/jobs/openshift/jenkins-client-plugin/OWNERS +++ b/ci-operator/jobs/openshift/jenkins-client-plugin/OWNERS @@ -1,4 +1,8 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/jenkins-client-plugin/blob/ac38bc1582f874f316eea623e0caad1dba482806/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - bparees - gabemontero -- jupierce \ No newline at end of file +- jupierce diff --git a/ci-operator/jobs/openshift/jenkins-openshift-login-plugin/OWNERS b/ci-operator/jobs/openshift/jenkins-openshift-login-plugin/OWNERS index b134666c0323..6ce5af968b20 100644 --- a/ci-operator/jobs/openshift/jenkins-openshift-login-plugin/OWNERS +++ b/ci-operator/jobs/openshift/jenkins-openshift-login-plugin/OWNERS @@ -1,3 +1,7 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/jenkins-openshift-login-plugin/blob/7eb3d649318225d19ddc5884451b6999236f2351/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - bparees -- gabemontero \ No newline at end of file +- gabemontero diff --git a/ci-operator/jobs/openshift/jenkins-plugin/OWNERS b/ci-operator/jobs/openshift/jenkins-plugin/OWNERS index b134666c0323..9065d54ed5d0 100644 --- a/ci-operator/jobs/openshift/jenkins-plugin/OWNERS +++ b/ci-operator/jobs/openshift/jenkins-plugin/OWNERS @@ -1,3 +1,7 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/jenkins-plugin/blob/ed4cf1ac84f8456e6844f5c14a08f7bcb94afe16/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - bparees -- gabemontero \ No newline at end of file +- gabemontero diff --git a/ci-operator/jobs/openshift/jenkins-sync-plugin/OWNERS b/ci-operator/jobs/openshift/jenkins-sync-plugin/OWNERS index b134666c0323..edecc7af2328 100644 --- a/ci-operator/jobs/openshift/jenkins-sync-plugin/OWNERS +++ b/ci-operator/jobs/openshift/jenkins-sync-plugin/OWNERS @@ -1,3 +1,7 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/jenkins-sync-plugin/blob/b37c5c5b121b266f12d31fdedfc3ac0fe84d0c10/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - bparees -- gabemontero \ No newline at end of file +- gabemontero diff --git a/ci-operator/jobs/openshift/jenkins/OWNERS b/ci-operator/jobs/openshift/jenkins/OWNERS index b134666c0323..023a5eba13ec 100644 --- a/ci-operator/jobs/openshift/jenkins/OWNERS +++ b/ci-operator/jobs/openshift/jenkins/OWNERS @@ -1,3 +1,7 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/jenkins/blob/5c3ee917ede2796be1a324a29ceb54d128007daa/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - bparees -- gabemontero \ No newline at end of file +- gabemontero diff --git a/ci-operator/jobs/openshift/kube-state-metrics/OWNERS b/ci-operator/jobs/openshift/kube-state-metrics/OWNERS index 613fd600823f..7cc634d0af20 100644 --- a/ci-operator/jobs/openshift/kube-state-metrics/OWNERS +++ b/ci-operator/jobs/openshift/kube-state-metrics/OWNERS @@ -1,7 +1,11 @@ -reviewers: - - brancz - - andyxning +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/kube-state-metrics/blob/3e5e2d70f1527db07c20f7dd747a57e971c592a9/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - - brancz - - andyxning - - fabxc +- brancz +- andyxning +- fabxc +reviewers: +- brancz +- andyxning diff --git a/ci-operator/jobs/openshift/machine-api-operator/OWNERS b/ci-operator/jobs/openshift/machine-api-operator/OWNERS index 898030684fde..ec452aba4604 100644 --- a/ci-operator/jobs/openshift/machine-api-operator/OWNERS +++ b/ci-operator/jobs/openshift/machine-api-operator/OWNERS @@ -1,7 +1,11 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/machine-api-operator/blob/2f4a03bfff35c8d0bf3fbf5b7804e89a637699f1/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - - enxebre - - frobware - - ingvagabund - - paulfantom - - spangenberg - - trawler +- enxebre +- frobware +- ingvagabund +- paulfantom +- spangenberg +- trawler diff --git a/ci-operator/jobs/openshift/machine-config-operator/OWNERS b/ci-operator/jobs/openshift/machine-config-operator/OWNERS index ef094ac44e02..ad91b240365b 100644 --- a/ci-operator/jobs/openshift/machine-config-operator/OWNERS +++ b/ci-operator/jobs/openshift/machine-config-operator/OWNERS @@ -1,8 +1,10 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/machine-config-operator/blob/a61de6ce1182f893ea69d0c6a38930dd1b3278df/OWNERS # See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md approvers: - - abhinavdahiya - - crawford - - smarterclayton - - wking - - yifan-gu +- abhinavdahiya +- crawford +- smarterclayton +- wking +- yifan-gu diff --git a/ci-operator/jobs/openshift/online-console-extensions/OWNERS b/ci-operator/jobs/openshift/online-console-extensions/OWNERS index 3e17f6cd9385..aa0dbb984cb5 100644 --- a/ci-operator/jobs/openshift/online-console-extensions/OWNERS +++ b/ci-operator/jobs/openshift/online-console-extensions/OWNERS @@ -1,17 +1,20 @@ -reviewers: - - abhgupta - - dak1n1 - - damemi - - dinhxuanvu - - lancejjohnson - - markturansky - - sallyom - - tiwillia -approvers: - - abhgupta - - markturansky - - tiwillia - - damemi - - sallyom - - dak1n1 +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/online-console-extensions/blob/6333d5b209e78364aeddbdceefec5bf42e4144f9/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md +approvers: +- abhgupta +- markturansky +- tiwillia +- damemi +- sallyom +- dak1n1 +reviewers: +- abhgupta +- dak1n1 +- damemi +- dinhxuanvu +- lancejjohnson +- markturansky +- sallyom +- tiwillia diff --git a/ci-operator/jobs/openshift/online-hibernation/OWNERS b/ci-operator/jobs/openshift/online-hibernation/OWNERS index f5c5c788c613..a0d1e95a2714 100644 --- a/ci-operator/jobs/openshift/online-hibernation/OWNERS +++ b/ci-operator/jobs/openshift/online-hibernation/OWNERS @@ -1,15 +1,18 @@ -reviewers: - - abhgupta - - dak1n1 - - damemi - - dinhxuanvu - - lancejjohnson - - markturansky - - sallyom - - thrasher-redhat - - tiwillia -approvers: - - abhgupta - - markturansky - - tiwillia +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/online-hibernation/blob/15eb8c27c8bbf2ddb861eed81371fb38ca413154/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md +approvers: +- abhgupta +- markturansky +- tiwillia +reviewers: +- abhgupta +- dak1n1 +- damemi +- dinhxuanvu +- lancejjohnson +- markturansky +- sallyom +- thrasher-redhat +- tiwillia diff --git a/ci-operator/jobs/openshift/online-registration/OWNERS b/ci-operator/jobs/openshift/online-registration/OWNERS index b632eb9e155d..9f8d038a666e 100644 --- a/ci-operator/jobs/openshift/online-registration/OWNERS +++ b/ci-operator/jobs/openshift/online-registration/OWNERS @@ -1,15 +1,18 @@ -reviewers: - - abhgupta - - dak1n1 - - damemi - - dinhxuanvu - - lancejjohnson - - markturansky - - sallyom - - tiwillia -approvers: - - abhgupta - - markturansky - - tiwillia - - lancejjohnson +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/online-registration/blob/1149b551e1708054d0c5c3a58641127cb30506fa/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md +approvers: +- abhgupta +- markturansky +- tiwillia +- lancejjohnson +reviewers: +- abhgupta +- dak1n1 +- damemi +- dinhxuanvu +- lancejjohnson +- markturansky +- sallyom +- tiwillia diff --git a/ci-operator/jobs/openshift/openshift-ansible/OWNERS b/ci-operator/jobs/openshift/openshift-ansible/OWNERS index e7adf39db00b..5c60122cc5df 100644 --- a/ci-operator/jobs/openshift/openshift-ansible/OWNERS +++ b/ci-operator/jobs/openshift/openshift-ansible/OWNERS @@ -1,12 +1,14 @@ -# approval == this is a good idea /approve +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/openshift-ansible/blob/35efde925809ef23e9a006681829417f1e3e515f/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - - michaelgugino - - mtnbikenc - - sdodson - - vrutkovs -# review == this code is good /lgtm +- michaelgugino +- mtnbikenc +- sdodson +- vrutkovs reviewers: - - michaelgugino - - mtnbikenc - - sdodson - - vrutkovs +- michaelgugino +- mtnbikenc +- sdodson +- vrutkovs diff --git a/ci-operator/jobs/openshift/openshift-azure/OWNERS b/ci-operator/jobs/openshift/openshift-azure/OWNERS index 0dfee8912216..129deed7c7aa 100644 --- a/ci-operator/jobs/openshift/openshift-azure/OWNERS +++ b/ci-operator/jobs/openshift/openshift-azure/OWNERS @@ -1,3 +1,7 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/openshift-azure/blob/6f486a0ad4184b4f5703764572c627cec17d8b75/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - jim-minter - kargakis @@ -5,9 +9,12 @@ approvers: - mjudeikis - pweil- reviewers: +- amanohar - jim-minter - kargakis - kwoodson - mjudeikis - pweil- +- shrutir25 +- sozercan - thanasisk diff --git a/ci-operator/jobs/openshift/origin-aggregated-logging/OWNERS b/ci-operator/jobs/openshift/origin-aggregated-logging/OWNERS index f860e14133ee..75a2c6327a62 100644 --- a/ci-operator/jobs/openshift/origin-aggregated-logging/OWNERS +++ b/ci-operator/jobs/openshift/origin-aggregated-logging/OWNERS @@ -1,16 +1,19 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/origin-aggregated-logging/blob/81901b7ab61f49d4660863594886c33c5eba54d7/OWNERS # See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - - jwforres - - jcantrill - - ewolinetz - - richm - - lukas-vlcek - - nhosoi - - josefkarasek - - nkinder +- jwforres +- jcantrill +- ewolinetz +- richm +- lukas-vlcek +- nhosoi +- josefkarasek +- nkinder reviewers: - - jwforres - - jcantrill - - ewolinetz - - richm - - nhosoi +- jwforres +- jcantrill +- ewolinetz +- richm +- nhosoi diff --git a/ci-operator/jobs/openshift/origin/OWNERS b/ci-operator/jobs/openshift/origin/OWNERS index e04702d5dc15..e95f3db9631e 100644 --- a/ci-operator/jobs/openshift/origin/OWNERS +++ b/ci-operator/jobs/openshift/origin/OWNERS @@ -1,19 +1,23 @@ -reviewers: - - smarterclayton - - deads2k - - liggitt - - bparees - - stevekuznetsov - - soltysh - - tbielawa +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/origin/blob/b0069e668a5d0413d3360c8eaf1fe425f83cd104/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - - smarterclayton - - deads2k - - liggitt - - bparees - - mfojtik - - eparis - - derekwaynecarr - - stevekuznetsov # for build and tooling changes - - tbielawa # also for build and automated release tooling changes - - pweil- +- smarterclayton +- deads2k +- liggitt +- bparees +- mfojtik +- eparis +- derekwaynecarr +- stevekuznetsov +- tbielawa +- pweil- +reviewers: +- smarterclayton +- deads2k +- liggitt +- bparees +- stevekuznetsov +- soltysh +- tbielawa diff --git a/ci-operator/jobs/openshift/ose/OWNERS b/ci-operator/jobs/openshift/ose/OWNERS index e04702d5dc15..538ae531c7f5 100644 --- a/ci-operator/jobs/openshift/ose/OWNERS +++ b/ci-operator/jobs/openshift/ose/OWNERS @@ -1,19 +1,23 @@ -reviewers: - - smarterclayton - - deads2k - - liggitt - - bparees - - stevekuznetsov - - soltysh - - tbielawa +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/ose/blob/a95c1941b98941e5374189a6fc25c66dc2fe7ebf/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - - smarterclayton - - deads2k - - liggitt - - bparees - - mfojtik - - eparis - - derekwaynecarr - - stevekuznetsov # for build and tooling changes - - tbielawa # also for build and automated release tooling changes - - pweil- +- smarterclayton +- deads2k +- liggitt +- bparees +- mfojtik +- eparis +- derekwaynecarr +- stevekuznetsov +- tbielawa +- pweil- +reviewers: +- smarterclayton +- deads2k +- liggitt +- bparees +- stevekuznetsov +- soltysh +- tbielawa diff --git a/ci-operator/jobs/openshift/release/OWNERS b/ci-operator/jobs/openshift/release/OWNERS index db3b5ee072d8..6e0837a1e84d 100644 --- a/ci-operator/jobs/openshift/release/OWNERS +++ b/ci-operator/jobs/openshift/release/OWNERS @@ -1,3 +1,7 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/release/blob/c4e5ab33800e232c770187b132f096ebafbfccfe/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - stevekuznetsov - smarterclayton diff --git a/ci-operator/jobs/openshift/service-catalog/OWNERS b/ci-operator/jobs/openshift/service-catalog/OWNERS index 35724d14e2c7..3df0df72d746 100644 --- a/ci-operator/jobs/openshift/service-catalog/OWNERS +++ b/ci-operator/jobs/openshift/service-catalog/OWNERS @@ -1,4 +1,9 @@ +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/service-catalog/blob/df5a8b34b6f66cf539dcf45e0827814df959348f/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - jpeeler - pmorie - jboyd01 +- luksa diff --git a/ci-operator/jobs/openshift/service-serving-cert-signer/OWNERS b/ci-operator/jobs/openshift/service-serving-cert-signer/OWNERS index 27fbbf15ce7b..85716c8cfad2 100644 --- a/ci-operator/jobs/openshift/service-serving-cert-signer/OWNERS +++ b/ci-operator/jobs/openshift/service-serving-cert-signer/OWNERS @@ -1,11 +1,15 @@ -reviewers: - - deads2k - - enj - - mfojtik - - mrogers950 - - simo5 - - soltysh +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/service-serving-cert-signer/blob/c2e19f18e28faa64433bc7ef634325eed8cd8a45/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + approvers: - - smarterclayton - - deads2k - - liggitt +- smarterclayton +- deads2k +- liggitt +reviewers: +- deads2k +- enj +- mfojtik +- mrogers950 +- simo5 +- soltysh diff --git a/ci-operator/jobs/openshift/telemeter/OWNERS b/ci-operator/jobs/openshift/telemeter/OWNERS index 0a2daaa98ad2..265ce6aca122 100644 --- a/ci-operator/jobs/openshift/telemeter/OWNERS +++ b/ci-operator/jobs/openshift/telemeter/OWNERS @@ -1,11 +1,14 @@ -reviewers: +# DO NOT EDIT; this file is auto-generated using tools/populate-owners. +# from https://github.com/openshift/telemeter/blob/465bdd9c8b8e4449a63b20dea82cbd4728b2fb2c/OWNERS +# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md + +approvers: - brancz - mxinden - squat - s-urbaniak - smarterclayton - -approvers: +reviewers: - brancz - mxinden - squat diff --git a/ci-operator/populate-owners.sh b/ci-operator/populate-owners.sh index fe33b9af6ae8..ec23ccaff05a 100755 --- a/ci-operator/populate-owners.sh +++ b/ci-operator/populate-owners.sh @@ -1,42 +1,6 @@ -#!/bin/bash +#!/bin/sh -# This script populates ConfigMaps using the configuration -# files in these directories. To be used to bootstrap the -# build cluster after a redeploy. +# This script runs /tools/populate-owners -set -o errexit -set -o nounset -set -o pipefail - - -temp_workdir=$( mktemp -d ) -trap "rm -rf ${temp_workdir}" EXIT - -function populate_owners() { - local org="$1" - local repo="$2" - local target_dir="${temp_workdir}/${org}/${repo}" - mkdir -p "${target_dir}" - git clone --depth 1 --single-branch "git@github.com:${org}/${repo}.git" "${target_dir}" - if [[ -f "${target_dir}/OWNERS" ]]; then - cp "${target_dir}/OWNERS" "${jobs}/${org}/${repo}" - if [[ -d "${config}/${org}/${repo}" ]]; then - cp "${target_dir}/OWNERS" "${config}/${org}/${repo}" - fi - fi -} - -jobs="$( dirname "${BASH_SOURCE[0]}" )/jobs" -config="$( dirname "${BASH_SOURCE[0]}" )/config" - -for org_dir in $( find "${jobs}" -mindepth 1 -maxdepth 1 -type d ); do - org="$( basename "${org_dir}" )" - for repo_dir in $( find "${jobs}/${org}" -mindepth 1 -maxdepth 1 -type d ); do - repo="$( basename "${repo_dir}" )" - populate_owners "${org}" "${repo}" & - done -done - -for job in $( jobs -p ); do - wait "${job}" -done \ No newline at end of file +REPO_ROOT="$(git rev-parse --show-toplevel)" && +exec go run "${REPO_ROOT}/tools/populate-owners/main.go" diff --git a/tools/populate-owners/OWNERS b/tools/populate-owners/OWNERS new file mode 100644 index 000000000000..fbd52a8f5b04 --- /dev/null +++ b/tools/populate-owners/OWNERS @@ -0,0 +1,3 @@ +approvers: +- stevekuznetsov +- wking diff --git a/tools/populate-owners/README.md b/tools/populate-owners/README.md new file mode 100644 index 000000000000..d3128c2ab161 --- /dev/null +++ b/tools/populate-owners/README.md @@ -0,0 +1,30 @@ +# Populating `OWNERS` and `OWNERS_ALIASES` + +This utility pulls `OWNERS` and `OWNERS_ALIASES` from upstream OpenShift repositories. +Usage: + +```console +$ go run main.go +``` + +Or, equivalently, execute [`populate-owners.sh`](../../ci-operator/populate-owners.sh) from anywhere in this repository. + +Upstream repositories are calculated from `ci-operator/jobs/{organization}/{repository}`. +For example, the presence of [`ci-operator/jobs/openshift/origin`](../../ci-operator/jobs/openshift/origin) inserts [openshift/origin][] as an upstream repository. + +The `HEAD` branch for each upstream repository is pulled to extract its `OWNERS` and `OWNERS_ALIASES`. +If `OWNERS` is missing, the utility will ignore `OWNERS_ALIASES`, even if it is present upstream. + +Once all the upstream content has been fetched, the utility namespaces any colliding upstream aliases. +Collisions only occur if multiple upstreams define the same alias with different member sets. +When that happens, the utility replaces the upstream alias with a `{organization}-{repository}-{upstream-alias}`. +For example, if [openshift/origin][] and [openshift/installer][] both defined an alias for `security` with different member sets, the utility would rename them to `openshift-origin-security` and `openshift-installer-security` respectively. + +After namespacing aliases, the utility writes `OWNERS_ALIASES` to the root of this repository. +If no upstreams define aliases, then the utility removes `OWNER_ALIASES` from the root of this repository. + +The utility also iterates through the `ci-operator/jobs/{organization}/{repository}` directories, writing `OWNERS` to reflect the upstream configuration. +If the upstream did not have an `OWNERS` file, the utility removes the associated `ci-operator/jobs/{organization}/{repository}/OWNERS`. + +[openshift/origin]: https://github.com/openshift/origin +[openshift/installer]: https://github.com/openshift/installer diff --git a/tools/populate-owners/main.go b/tools/populate-owners/main.go new file mode 100644 index 000000000000..b3adc39f4921 --- /dev/null +++ b/tools/populate-owners/main.go @@ -0,0 +1,332 @@ +package main + +import ( + "fmt" + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "reflect" + "sort" + "strings" + + "gopkg.in/yaml.v2" +) + +const ( + doNotEdit = "# DO NOT EDIT; this file is auto-generated using tools/populate-owners.\n" + ownersComment = "# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md\n" + ownersAliasesComment = "# See the OWNERS_ALIASES docs: https://git.k8s.io/community/contributors/guide/owners.md#owners_aliases\n" +) + +// owners is copied from k8s.io/test-infra/prow/repoowners's Config +type owners struct { + Approvers []string `json:"approvers,omitempty" yaml:"approvers,omitempty"` + Reviewers []string `json:"reviewers,omitempty" yaml:"reviewers,omitempty"` + RequiredReviewers []string `json:"required_reviewers,omitempty" yaml:"required_reviewers,omitempty"` + Labels []string `json:"labels,omitempty" yaml:"labels,omitempty"` +} + +type aliases struct { + Aliases map[string][]string `json:"aliases,omitempty" yaml:"aliases,omitempty"` +} + +type orgRepo struct { + Directories []string `json:"directories,omitempty" yaml:"directories,omitempty"` + Organization string `json:"organization,omitempty" yaml:"organization,omitempty"` + Repository string `json:"repository,omitempty" yaml:"repository,omitempty"` + Owners *owners `json:"owners,omitempty" yaml:"owners,omitempty"` + Aliases *aliases `json:"aliases,omitempty" yaml:"aliases,omitempty"` + Commit string `json:"commit,omitempty" yaml:"commit,omitempty"` +} + +func getRepoRoot(directory string) (root string, err error) { + initialDir, err := filepath.Abs(directory) + if err != nil { + return "", err + } + + path := initialDir + for { + info, err := os.Stat(filepath.Join(path, ".git")) + if err == nil { + if info.IsDir() { + break + } + } else if !os.IsNotExist(err) { + return "", err + } + + parent := filepath.Dir(path) + if parent == path { + return "", fmt.Errorf("no .git found under %q", initialDir) + } + + path = parent + } + + return path, nil +} + +func orgRepos(dir string) (orgRepos []*orgRepo, err error) { + matches, err := filepath.Glob(filepath.Join(dir, "*", "*")) + if err != nil { + return nil, err + } + sort.Strings(matches) + + orgRepos = make([]*orgRepo, len(matches)) + for i, path := range matches { + relpath, err := filepath.Rel(dir, path) + if err != nil { + return nil, err + } + org, repo := filepath.Split(relpath) + org = strings.TrimSuffix(org, string(filepath.Separator)) + orgRepos[i] = &orgRepo{ + Directories: []string{path}, + Organization: org, + Repository: repo, + } + } + + return orgRepos, err +} + +func (orgRepo *orgRepo) getOwners() (err error) { + dir, err := ioutil.TempDir("", "populate-owners-") + if err != nil { + return err + } + defer os.RemoveAll(dir) + + gitURL := fmt.Sprintf("ssh://git@github.com/%s/%s.git", orgRepo.Organization, orgRepo.Repository) + cmd := exec.Command("git", "clone", "--depth=1", "--single-branch", gitURL, dir) + cmd.Stderr = os.Stderr + err = cmd.Run() + if err != nil { + return err + } + + return orgRepo.extractOwners(dir) +} + +func (orgRepo *orgRepo) extractOwners(repoRoot string) (err error) { + cmd := exec.Command("git", "rev-parse", "HEAD") + cmd.Stderr = os.Stderr + cmd.Dir = repoRoot + stdout, err := cmd.StdoutPipe() + if err != nil { + return err + } + err = cmd.Start() + if err != nil { + return err + } + hash, err := ioutil.ReadAll(stdout) + if err != nil { + return err + } + err = cmd.Wait() + if err != nil { + return err + } + orgRepo.Commit = strings.TrimSuffix(string(hash), "\n") + + data, err := ioutil.ReadFile(filepath.Join(repoRoot, "OWNERS")) + if err != nil { + return err + } + + err = yaml.Unmarshal(data, &orgRepo.Owners) + if err != nil { + return err + } + + data, err = ioutil.ReadFile(filepath.Join(repoRoot, "OWNERS_ALIASES")) + if err != nil { + return err + } + + err = yaml.Unmarshal(data, &orgRepo.Aliases) + if err != nil { + return err + } + + return nil +} + +// namespaceAliases collects a set of aliases including all upstream +// aliases. If multiple upstreams define the same alias with different +// member sets, namespaceAliases renames the colliding aliases in both +// the input 'orgRepos' and the output 'collected' to use +// unique-to-each-upstream alias names. +func namespaceAliases(orgRepos []*orgRepo) (collected *aliases, err error) { + consumerMap := map[string][]*orgRepo{} + for _, orgRepo := range orgRepos { + if orgRepo.Aliases == nil { + continue + } + + for alias := range orgRepo.Aliases.Aliases { + consumerMap[alias] = append(consumerMap[alias], orgRepo) + } + } + + if len(consumerMap) == 0 { + return nil, nil + } + + collected = &aliases{ + Aliases: map[string][]string{}, + } + + for alias, consumers := range consumerMap { + namespace := false + members := consumers[0].Aliases.Aliases[alias] + for _, consumer := range consumers[1:] { + otherMembers := consumer.Aliases.Aliases[alias] + if !reflect.DeepEqual(members, otherMembers) { + namespace = true + break + } + } + + for i, consumer := range consumers { + newAlias := alias + if namespace { + newAlias = fmt.Sprintf("%s-%s-%s", consumer.Organization, consumer.Repository, alias) + consumer.Aliases.Aliases[newAlias] = consumer.Aliases.Aliases[alias] + delete(consumer.Aliases.Aliases, alias) + } + fmt.Fprintf( + os.Stderr, + "injecting alias %q from https://github.com/%s/%s/blob/%s/OWNERS_ALIASES\n", + alias, + consumer.Organization, + consumer.Repository, + consumer.Commit, + ) + if i == 0 || namespace { + _, ok := collected.Aliases[newAlias] + if ok { + return nil, fmt.Errorf("namespaced alias collision: %q", newAlias) + } + collected.Aliases[newAlias] = consumer.Aliases.Aliases[newAlias] + } + } + } + + return collected, nil +} + +func writeYAML(path string, data interface{}, prefix []string) (err error) { + file, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666) + if err != nil { + return err + } + defer file.Close() + + for _, line := range prefix { + _, err := file.Write([]byte(line)) + if err != nil { + return err + } + } + + encoder := yaml.NewEncoder(file) + return encoder.Encode(data) +} + +func (orgRepo *orgRepo) writeOwners() (err error) { + for _, directory := range orgRepo.Directories { + path := filepath.Join(directory, "OWNERS") + if orgRepo.Owners == nil { + err := os.Remove(path) + if err != nil && !os.IsNotExist(err) { + return err + } + continue + } + + err = writeYAML(path, orgRepo.Owners, []string{ + doNotEdit, + fmt.Sprintf( + "# from https://github.com/%s/%s/blob/%s/OWNERS\n", + orgRepo.Organization, + orgRepo.Repository, + orgRepo.Commit, + ), + ownersComment, + "\n", + }) + if err != nil { + return err + } + } + + return nil +} + +func writeOwnerAliases(repoRoot string, aliases *aliases) (err error) { + path := filepath.Join(repoRoot, "OWNERS_ALIASES") + if aliases == nil || len(aliases.Aliases) == 0 { + err = os.Remove(path) + if err != nil && !os.IsNotExist(err) { + return err + } + return nil + } + + return writeYAML(path, aliases, []string{ + doNotEdit, + ownersAliasesComment, + "\n", + }) +} + +func pullOwners(directory string) (err error) { + repoRoot, err := getRepoRoot(directory) + if err != nil { + return err + } + + orgRepos, err := orgRepos(filepath.Join(repoRoot, "ci-operator", "jobs")) + if err != nil { + return err + } + + for _, orgRepo := range orgRepos { + err := orgRepo.getOwners() + if err != nil && !os.IsNotExist(err) { + return err + } + } + + aliases, err := namespaceAliases(orgRepos) + if err != nil { + return err + } + + err = writeOwnerAliases(repoRoot, aliases) + if err != nil { + return err + } + + for _, orgRepo := range orgRepos { + err = orgRepo.writeOwners() + if err != nil { + return err + } + } + + return nil +} + +func main() { + err := pullOwners(".") + if err != nil { + fmt.Fprintln(os.Stderr, err.Error()) + os.Exit(1) + } +} diff --git a/tools/populate-owners/main_test.go b/tools/populate-owners/main_test.go new file mode 100644 index 000000000000..a084aef8e0e5 --- /dev/null +++ b/tools/populate-owners/main_test.go @@ -0,0 +1,454 @@ +package main + +import ( + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "reflect" + "regexp" + "testing" +) + +func assertEqual(t *testing.T, actual, expected interface{}) { + if !reflect.DeepEqual(actual, expected) { + t.Fatalf("unexpected result: %+v != %+v", actual, expected) + } +} + +func TestGetRepoRoot(t *testing.T) { + dir, err := ioutil.TempDir("", "populate-owners-") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(dir) + + root := filepath.Join(dir, "root") + deep := filepath.Join(root, "a", "b", "c") + git := filepath.Join(root, ".git") + err = os.MkdirAll(deep, 0777) + if err != nil { + t.Fatal(err) + } + err = os.Mkdir(git, 0777) + if err != nil { + t.Fatal(err) + } + + t.Run("from inside the repository", func(t *testing.T) { + found, err := getRepoRoot(deep) + if err != nil { + t.Fatal(err) + } + if found != root { + t.Fatalf("unexpected root: %q != %q", found, root) + } + }) + + t.Run("from outside the repository", func(t *testing.T) { + _, err := getRepoRoot(dir) + if err == nil { + t.Fatal(err) + } + }) +} + +func TestOrgRepos(t *testing.T) { + dir, err := ioutil.TempDir("", "populate-owners-") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(dir) + + repoAB := filepath.Join(dir, "a", "b") + repoCD := filepath.Join(dir, "c", "d") + err = os.MkdirAll(repoAB, 0777) + if err != nil { + t.Fatal(err) + } + err = os.MkdirAll(repoCD, 0777) + if err != nil { + t.Fatal(err) + } + + orgRepos, err := orgRepos(dir) + if err != nil { + t.Fatal(err) + } + + expected := []*orgRepo{ + { + Directories: []string{repoAB}, + Organization: "a", + Repository: "b", + }, + { + Directories: []string{repoCD}, + Organization: "c", + Repository: "d", + }, + } + + assertEqual(t, orgRepos, expected) +} + +func TestExtractOwners(t *testing.T) { + dir, err := ioutil.TempDir("", "populate-owners-") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(dir) + + err = ioutil.WriteFile(filepath.Join(dir, "README"), []byte("Hello, World!\n"), 0666) + if err != nil { + t.Fatal(err) + } + + for _, args := range [][]string{ + {"git", "init"}, + {"git", "add", "README"}, + {"git", "commit", "-m", "Begin versioning"}, + } { + cmd := exec.Command(args[0], args[1:]...) + cmd.Dir = dir + cmd.Env = []string{ // for stable commit hashes + "GIT_COMMITTER_DATE=1112911993 -0700", + "GIT_AUTHOR_DATE=1112911993 -0700", + } + err = cmd.Run() + if err != nil { + t.Fatal(err) + } + } + + for _, test := range []struct { + name string + setup string + expected *orgRepo + error *regexp.Regexp + }{ + { + name: "no OWNERS", + expected: &orgRepo{ + Commit: "3e7341c55330a127038bfc8d7a396d4951049b85", + }, + error: regexp.MustCompile("^open .*/populate-owners-[0-9]*/OWNERS: no such file or directory"), + }, + { + name: "only OWNERS", + setup: "OWNERS", + expected: &orgRepo{ + Owners: &owners{Approvers: []string{"alice", "bob"}}, + Commit: "3e7341c55330a127038bfc8d7a396d4951049b85", + }, + error: regexp.MustCompile("^open .*/populate-owners-[0-9]*/OWNERS_ALIASES: no such file or directory"), + }, + { + name: "OWNERS and OWNERS_ALIASES", + setup: "OWNERS_ALIASES", + expected: &orgRepo{ + Owners: &owners{Approvers: []string{"sig-alias"}}, + Aliases: &aliases{Aliases: map[string][]string{"sig-alias": {"alice", "bob"}}}, + Commit: "3e7341c55330a127038bfc8d7a396d4951049b85", + }, + }, + } { + t.Run(test.name, func(t *testing.T) { + switch test.setup { + case "": // nothing to do + case "OWNERS": + err = ioutil.WriteFile( + filepath.Join(dir, "OWNERS"), + []byte("approvers:\n- alice\n- bob\n"), + 0666, + ) + if err != nil { + t.Fatal(err) + } + case "OWNERS_ALIASES": + err = ioutil.WriteFile( + filepath.Join(dir, "OWNERS"), + []byte("approvers:\n- sig-alias\n"), + 0666, + ) + if err != nil { + t.Fatal(err) + } + err = ioutil.WriteFile( + filepath.Join(dir, "OWNERS_ALIASES"), + []byte("aliases:\n sig-alias:\n - alice\n - bob\n"), + 0666, + ) + if err != nil { + t.Fatal(err) + } + default: + t.Fatalf("unrecognized setup: %q", test.setup) + } + + orgrepo := &orgRepo{} + err := orgrepo.extractOwners(dir) + if test.error == nil { + if err != nil { + t.Fatal(err) + } + } else if !test.error.MatchString(err.Error()) { + t.Fatalf("unexpected error: %v does not match %v", err, test.error) + } + + assertEqual(t, orgrepo, test.expected) + }) + } +} + +func TestNamespaceAliases(t *testing.T) { + for _, test := range []struct { + name string + input []*orgRepo + namespaced []*orgRepo + collected *aliases + error *regexp.Regexp + }{ + { + name: "no alias name collisions, so no namespaced aliases created", + input: []*orgRepo{ + { + Organization: "a", + Repository: "b", + Aliases: &aliases{Aliases: map[string][]string{ + "ab": {"alice", "bob"}, + }}, + }, + { + Organization: "c", + Repository: "d", + Aliases: &aliases{Aliases: map[string][]string{ + "cd": {"bob", "charlie"}, + }}, + }, + }, + namespaced: []*orgRepo{ + { + Organization: "a", + Repository: "b", + Aliases: &aliases{Aliases: map[string][]string{ + "ab": {"alice", "bob"}, + }}, + }, + { + Organization: "c", + Repository: "d", + Aliases: &aliases{Aliases: map[string][]string{ + "cd": {"bob", "charlie"}, + }}, + }, + }, + collected: &aliases{Aliases: map[string][]string{ + "ab": {"alice", "bob"}, + "cd": {"bob", "charlie"}, + }}, + }, + { + name: "matching members, so no namespaced aliases created", + input: []*orgRepo{ + { + Organization: "a", + Repository: "b", + Aliases: &aliases{Aliases: map[string][]string{ + "ab": {"alice", "bob"}, + }}, + }, + { + Organization: "c", + Repository: "d", + Aliases: &aliases{Aliases: map[string][]string{ + "ab": {"alice", "bob"}, + }}, + }, + }, + namespaced: []*orgRepo{ + { + Organization: "a", + Repository: "b", + Aliases: &aliases{Aliases: map[string][]string{ + "ab": {"alice", "bob"}, + }}, + }, + { + Organization: "c", + Repository: "d", + Aliases: &aliases{Aliases: map[string][]string{ + "ab": {"alice", "bob"}, + }}, + }, + }, + collected: &aliases{Aliases: map[string][]string{ + "ab": {"alice", "bob"}, + }}, + }, + { + name: "different members, so namespaced aliases created", + input: []*orgRepo{ + { + Organization: "a", + Repository: "b", + Aliases: &aliases{Aliases: map[string][]string{ + "ab": {"alice", "bob"}, + }}, + }, + { + Organization: "c", + Repository: "d", + Aliases: &aliases{Aliases: map[string][]string{ + "ab": {"bob", "charlie"}, + }}, + }, + }, + namespaced: []*orgRepo{ + { + Organization: "a", + Repository: "b", + Aliases: &aliases{Aliases: map[string][]string{ + "a-b-ab": {"alice", "bob"}, + }}, + }, + { + Organization: "c", + Repository: "d", + Aliases: &aliases{Aliases: map[string][]string{ + "c-d-ab": {"bob", "charlie"}, + }}, + }, + }, + collected: &aliases{Aliases: map[string][]string{ + "a-b-ab": {"alice", "bob"}, + "c-d-ab": {"bob", "charlie"}, + }}, + }, + { + name: "collisions after namespacing", + input: []*orgRepo{ + { + Organization: "a", + Repository: "b", + Aliases: &aliases{Aliases: map[string][]string{ + "ab": {"alice", "bob"}, + }}, + }, + { + Organization: "c", + Repository: "d", + Aliases: &aliases{Aliases: map[string][]string{ + "ab": {"bob", "charlie"}, + }}, + }, + { + Organization: "e", + Repository: "f", + Aliases: &aliases{Aliases: map[string][]string{ + "a-b-ab": {"bob", "charlie"}, + }}, + }, + }, + error: regexp.MustCompile("^namespaced alias collision: \"a-b-ab\"$"), + }, + } { + t.Run(test.name, func(t *testing.T) { + collected, err := namespaceAliases(test.input) + if test.error == nil { + if err != nil { + t.Fatal(err) + } + } else if !test.error.MatchString(err.Error()) { + t.Fatalf("unexpected error: %v does not match %v", err, test.error) + } + + assertEqual(t, collected, test.collected) + if test.namespaced != nil { + assertEqual(t, test.input, test.namespaced) + } + }) + } +} + +func TestWriteYAML(t *testing.T) { + dir, err := ioutil.TempDir("", "populate-owners-") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(dir) + + for _, test := range []struct { + name string + filename string + data interface{} + expected string + }{ + { + name: "OWNERS", + filename: "OWNERS", + data: &owners{ + Approvers: []string{"alice", "bob"}, + }, + expected: `# prefix 1 +# prefix 2 + +approvers: +- alice +- bob +`, + }, + { + name: "OWNERS overwrite", + filename: "OWNERS", + data: &owners{ + Approvers: []string{"bob", "charlie"}, + }, + expected: `# prefix 1 +# prefix 2 + +approvers: +- bob +- charlie +`, + }, + { + name: "OWNERS_ALIASES", + filename: "OWNERS_ALIASES", + data: &aliases{ + Aliases: map[string][]string{ + "group-1": {"alice", "bob"}, + }, + }, + expected: `# prefix 1 +# prefix 2 + +aliases: + group-1: + - alice + - bob +`, + }, + } { + t.Run(test.name, func(t *testing.T) { + path := filepath.Join(dir, test.filename) + err = writeYAML( + path, + test.data, + []string{"# prefix 1\n", "# prefix 2\n", "\n"}, + ) + if err != nil { + t.Fatal(err) + } + + data, err := ioutil.ReadFile(path) + if err != nil { + t.Fatal(err) + } + + if string(data) != test.expected { + t.Fatalf("unexpected result:\n---\n%s\n--- != ---\n%s\n---\n", string(data), test.expected) + } + }) + } +}