Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore][CI/CD] Fix github action for pinging code owners on some components #29572

Merged
merged 3 commits into from
Nov 30, 2023

Conversation

crobert-1
Copy link
Member

Description:

Existing bug:
This resolves a bug in pinging code owners that was hit when a base component doesn't end with its type, but has multiple sub-components.

For example, when adding the label extension/encoding to issues code owners weren't being pinged. This is because there are multiple sub-components (e.g. extension/encoding/jaegarencodingextension, extension/encoding/zipkinencodingextension, etc), and extension/encoding doesn't end with its own type extension.

Solution:
The solution to this bug is to also check if the original component can be found if a single / is appended to it. This finds the component in a determinate way and allows code owners to be pinged properly.

Link to tracking Issue:

Resolves #29571

Testing:

crobert$ ~/dev/opentelemetry-collector-contrib $ export COMPONENT=extension/encoding
crobert$ ~/dev/opentelemetry-collector-contrib $ .github/workflows/scripts/get-codeowners.sh 
@atoulme @dao-jun @dmitryax @MovieStoreGuy @VihasMakwana
crobert$ ~/dev/opentelemetry-collector-contrib $ export COMPONENT=extension/encoding/zipkinencoding
crobert$ ~/dev/opentelemetry-collector-contrib $ .github/workflows/scripts/get-codeowners.sh 
@MovieStoreGuy @dao-jun
crobert$ ~/dev/opentelemetry-collector-contrib $ export COMPONENT=processor/resourcedetection
crobert$ ~/dev/opentelemetry-collector-contrib $ .github/workflows/scripts/get-codeowners.sh 
@Aneurysm9 @dashpole
crobert$ ~/dev/opentelemetry-collector-contrib $ export COMPONENT=extension/observer
crobert$ ~/dev/opentelemetry-collector-contrib $ .github/workflows/scripts/get-codeowners.sh
@dmitryax @rmfitzpatrick
crobert$ ~/dev/opentelemetry-collector-contrib $ export COMPONENT=processor/resource
crobert$ ~/dev/opentelemetry-collector-contrib $ .github/workflows/scripts/get-codeowners.sh
@dmitryax

Previously, extension/observer and extension/encoding returned nothing, which was the bug this resolves.

Check another component name where you just append the name
with a backslash.
@crobert-1 crobert-1 requested review from a team and TylerHelmuth November 29, 2023 21:05
@crobert-1 crobert-1 added ci-cd CI, CD, testing, build issues github_actions Pull requests that update Github_actions code bug Something isn't working labels Nov 29, 2023
@@ -9,6 +9,10 @@

set -euo pipefail

get_codeowners() {
echo "$((grep -m 1 "${1}" .github/CODEOWNERS || true) | sed 's/ */ /g' | cut -f3- -d ' ')"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the exact same logic as before, just using the argument passed to the function instead of a global variable.

.github/workflows/scripts/get-codeowners.sh Outdated Show resolved Hide resolved

OWNERS=$( (grep -m 1 "${COMPONENT}" .github/CODEOWNERS || true) | sed 's/ */ /g' | cut -f3- -d ' ' )
if [[ -z "${OWNERS:-}" ]]; then
Copy link
Member Author

@crobert-1 crobert-1 Nov 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Existing code structure should be the same as before, just a single condition is added. Originally there was a single statement setting OWNERS because COMPONENT was modified to have the COMPONENT_TYPE appended to it.

So even though there's an if/else condition here now, it's the same logic, just an extra condition for the / appended instead of COMPONENT_TYPE.

@github-actions github-actions bot added the cmd/otelcontribcol otelcontribcol command label Nov 29, 2023
@crobert-1
Copy link
Member Author

If we want to really ensure this worked, we can add labels to this PR to make sure code owners are pinged. It would be noisy for them, but probably better than merging if I somehow broke something. Otherwise I can test on an issue this is broken for after its merged.

@atoulme
Copy link
Contributor

atoulme commented Nov 29, 2023

Let's try it with one component and see if it works.

@atoulme
Copy link
Contributor

atoulme commented Nov 29, 2023

It doesn't I guess since it applies the script from main, so we need to merge this to see if it works.

Copy link
Contributor

@evan-bradley evan-bradley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really appreciate you taking a look at this.

@evan-bradley evan-bradley merged commit a7ef224 into open-telemetry:main Nov 30, 2023
91 checks passed
@github-actions github-actions bot added this to the next release milestone Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ci-cd CI, CD, testing, build issues cmd/otelcontribcol otelcontribcol command github_actions Pull requests that update Github_actions code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CI/CD] Ping code owners does not work on some components that share base names
5 participants