[CI/CD] Ping code owners does not work on some components that share base names #29571
Labels
bug
Something isn't working
ci-cd
CI, CD, testing, build issues
github_actions
Pull requests that update Github_actions code
Component(s)
No response
Describe the issue you're reporting
Problem
Our current workflow requires
github-actions
to ping code owners adding labels to issues and PRs. However, there's a bug currently that is hit for a label of a base component when there are multiple sub-components that share the same name, but the base name does not end in its component type.Places where no pings are happening but should be:
#29082
#18491
#27046
(There are more)
Example Components
The
extension/encoding
label will not ping code owners, but the rest will. So in the terminology I'm using,extension/encoding
is the base component,extension/encoding/zipkinencodingextension
would be a sub-component, and the component type isextension
.The
extension/observer
label will not ping code owners, but the rest will.Problem code
The problem is in
get-codeowners.sh
here:RESULT
is the number of lines matched by grepping the component passed in. In the case ofCOMPONENT=extension/encoding
,RESULT
is set to 6. The script then appends theCOMPONENT_TYPE
,extension
in this case, to theCOMPONENT
and attempts to parse code owners from this component. However, there's noCOMPONENT
in the code owners fileextension/encodingextension
. This results in no pings being sent and the script ends "successfully"This code is in place for some components that have labels that don't match their code owner entry name. One example is the resource detection processor. The label is
processor/resourcedetection
, but the code owners line isprocessor/resourcedetectionprocessor
.Solution
There are a few possible solutions here:
get-codeowners.sh
that simply appends a/
to the original component, before appending component type. Check if there are any results for this component, if so, return code owners as we know we matched the full path. In my given examples, the script would then search theCODEOWNERS
file forextension/encoding/
orprocessor/resourcedetection/
. At worst, no owners would be returned. Otherwise, it would properly find the entry and return owners in a determinate way. This seems like the best solution.Remove the functionality of appendingThis would not work asCOMPONENT_TYPE
entirely. This would technically work today for all components as all of the base components are listed before their sub-components. This would work because theget-codeowners.sh
script returns the first line in the file that matches theCOMPONENT
. The downside here is it would be order dependent in the CODEOWNERS file. This would introduce some level of instability though, so it's not a perfect solution.processor/resourcedetectionprocessor
is beforeprocessor/resourceprocessor
alphabetically. If we removed append, the labelprocessor/resource
would pingprocessor/resourcedetection
code owners incorrectly, as it comes before the resource processor alphabetically.The text was updated successfully, but these errors were encountered: