-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Remove path parts from component label suffixes #38622
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Hi there! You need to sign the CLA in order for us to be able to accept your contribution. Could you take a look at this? Thanks! |
4d35745
to
69e855a
Compare
Seems like you need to run |
atoulme
approved these changes
Mar 18, 2025
This was referenced Mar 19, 2025
atoulme
pushed a commit
that referenced
this pull request
Mar 20, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Lately some `Ping code owners on a new issue` action runs have [been failing](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/13972340605/job/39117145364) with the following error: ``` ./.github/workflows/scripts/ping-codeowners-on-new-issue.sh: line 36: COMPONENT: unbound variable ``` This was because recently a variable reference was changed to the wrong variable name, view the diff of the related PR to see the context. Related: #38622
atoulme
pushed a commit
that referenced
this pull request
Mar 20, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description The current `awk` expression will return all matches, so if a component label is a substring of another component label, the resulting label will be all matching labels appended to each other. Example: #38780 The label wasn't originally added because the [found label was too long to add](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/13938538170/job/39010977164). However, code owners were properly pinged. When I added the proper label, the [incorrect label name was detected](#38780 (comment)). When searching the `.github/component_labels.txt` file, the label we want to add is the first match that we find. This is the **minimally matching label**, since the file is in alphabetical order. There may be a better `awk` way to implement this logic, but `head -n 1` returns the first matching line, if any are found in the given text. <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Related #38622 <!--Describe what testing was performed and which tests were added.--> #### Testing **Before:** ``` crobert$ ~/dev/contrib/first $ COMPONENT="receiver/hostmetrics" crobert$ ~/dev/contrib/first $ awk -v path="${COMPONENT}" 'index($1, path) > 0 || index($2, path) > 0 {print $1}' .github/component_labels.txt receiver/hostmetricsreceiver receiver/hostmetricsreceiver/internal/scraper/cpuscraper receiver/hostmetricsreceiver/internal/scraper/diskscraper receiver/hostmetricsreceiver/internal/scraper/filesystemscraper receiver/hostmetricsreceiver/internal/scraper/loadscraper receiver/hostmetricsreceiver/internal/scraper/memoryscraper receiver/hostmetricsreceiver/internal/scraper/networkscraper receiver/hostmetricsreceiver/internal/scraper/pagingscraper receiver/hostmetricsreceiver/internal/scraper/processesscraper receiver/hostmetricsreceiver/internal/scraper/processscraper receiver/hostmetricsreceiver/internal/scraper/systemscraper crobert$ ~/dev/contrib/first $ COMPONENT="extension/encoding" crobert$ ~/dev/contrib/first $ awk -v path="${COMPONENT}" 'index($1, path) > 0 || index($2, path) > 0 {print $1}' .github/component_labels.txt extension/encoding extension/encoding/avrologencodingextension extension/encoding/awscloudwatchmetricstreamsencodingextension extension/encoding/awslogsencodingextension extension/encoding/googlecloudlogentryencodingextension extension/encoding/jaegerencodingextension extension/encoding/jsonlogencodingextension extension/encoding/otlpencodingextension extension/encoding/skywalkingencodingextension extension/encoding/textencodingextension extension/encoding/zipkinencodingextension ``` **After:** ``` crobert$ ~/dev/contrib/first $ COMPONENT="receiver/hostmetrics" crobert$ ~/dev/contrib/first $ awk -v path="${COMPONENT}" 'index($1, path) > 0 || index($2, path) > 0 {print $1}' .github/component_labels.txt | head -n 1 receiver/hostmetricsreceiver crobert$ ~/dev/contrib/first $ COMPONENT="extension/encoding" crobert$ ~/dev/contrib/first $ awk -v path="${COMPONENT}" 'index($1, path) > 0 || index($2, path) > 0 {print $1}' .github/component_labels.txt | head -n 1 extension/encoding
atoulme
pushed a commit
that referenced
this pull request
Mar 21, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description After checking the component labels file, `COMPONENT` may be empty if the label added is not for a component. This is a valid and acceptable state. If the label does not correspond to a component, code owners don't need to be pinged. This is to fix the following [example failure](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/13994662160/job/39186701459). <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Related to #38622 Before the related PR the passed in component was checked to make sure it wasn't empty and passed directly to the `get-codeowners.sh` script, which fails if `COMPONENT` is empty, and returns an empty string successfully if the given label is not a component. After the change, `COMPONENT` is modified to potentially be empty, then passed to `get-codeowners.sh`. This is what caused the `1` return code. <!--Describe what testing was performed and which tests were added.--> #### Testing Tested locally with the label `os:windows`. The script passes with the change, failed before.
Fiery-Fenix
pushed a commit
to Fiery-Fenix/opentelemetry-collector-contrib
that referenced
this pull request
Apr 24, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description To generate labels for all components, including those with paths longer than 50 characters: In the root Makefile, a phony target is created to generate the .github/component_labels file, which contains the component paths and their corresponding labels (shortened paths for those exceeding 50 characters by removing repeated patterns in the string). The file is space-delimited. In the build-and-test workflow, under the checks job, a step is added to verify that the .github/component_labels file exists. The scripts used in the workflows are adjusted to use the .github/component_labels file as a reference for mappings between component paths and their labels. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#38527
Fiery-Fenix
pushed a commit
to Fiery-Fenix/opentelemetry-collector-contrib
that referenced
this pull request
Apr 24, 2025
…elemetry#38840) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Lately some `Ping code owners on a new issue` action runs have [been failing](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/13972340605/job/39117145364) with the following error: ``` ./.github/workflows/scripts/ping-codeowners-on-new-issue.sh: line 36: COMPONENT: unbound variable ``` This was because recently a variable reference was changed to the wrong variable name, view the diff of the related PR to see the context. Related: open-telemetry#38622
Fiery-Fenix
pushed a commit
to Fiery-Fenix/opentelemetry-collector-contrib
that referenced
this pull request
Apr 24, 2025
…metry#38844) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description The current `awk` expression will return all matches, so if a component label is a substring of another component label, the resulting label will be all matching labels appended to each other. Example: open-telemetry#38780 The label wasn't originally added because the [found label was too long to add](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/13938538170/job/39010977164). However, code owners were properly pinged. When I added the proper label, the [incorrect label name was detected](open-telemetry#38780 (comment)). When searching the `.github/component_labels.txt` file, the label we want to add is the first match that we find. This is the **minimally matching label**, since the file is in alphabetical order. There may be a better `awk` way to implement this logic, but `head -n 1` returns the first matching line, if any are found in the given text. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Related open-telemetry#38622 <!--Describe what testing was performed and which tests were added.--> #### Testing **Before:** ``` crobert$ ~/dev/contrib/first $ COMPONENT="receiver/hostmetrics" crobert$ ~/dev/contrib/first $ awk -v path="${COMPONENT}" 'index($1, path) > 0 || index($2, path) > 0 {print $1}' .github/component_labels.txt receiver/hostmetricsreceiver receiver/hostmetricsreceiver/internal/scraper/cpuscraper receiver/hostmetricsreceiver/internal/scraper/diskscraper receiver/hostmetricsreceiver/internal/scraper/filesystemscraper receiver/hostmetricsreceiver/internal/scraper/loadscraper receiver/hostmetricsreceiver/internal/scraper/memoryscraper receiver/hostmetricsreceiver/internal/scraper/networkscraper receiver/hostmetricsreceiver/internal/scraper/pagingscraper receiver/hostmetricsreceiver/internal/scraper/processesscraper receiver/hostmetricsreceiver/internal/scraper/processscraper receiver/hostmetricsreceiver/internal/scraper/systemscraper crobert$ ~/dev/contrib/first $ COMPONENT="extension/encoding" crobert$ ~/dev/contrib/first $ awk -v path="${COMPONENT}" 'index($1, path) > 0 || index($2, path) > 0 {print $1}' .github/component_labels.txt extension/encoding extension/encoding/avrologencodingextension extension/encoding/awscloudwatchmetricstreamsencodingextension extension/encoding/awslogsencodingextension extension/encoding/googlecloudlogentryencodingextension extension/encoding/jaegerencodingextension extension/encoding/jsonlogencodingextension extension/encoding/otlpencodingextension extension/encoding/skywalkingencodingextension extension/encoding/textencodingextension extension/encoding/zipkinencodingextension ``` **After:** ``` crobert$ ~/dev/contrib/first $ COMPONENT="receiver/hostmetrics" crobert$ ~/dev/contrib/first $ awk -v path="${COMPONENT}" 'index($1, path) > 0 || index($2, path) > 0 {print $1}' .github/component_labels.txt | head -n 1 receiver/hostmetricsreceiver crobert$ ~/dev/contrib/first $ COMPONENT="extension/encoding" crobert$ ~/dev/contrib/first $ awk -v path="${COMPONENT}" 'index($1, path) > 0 || index($2, path) > 0 {print $1}' .github/component_labels.txt | head -n 1 extension/encoding
Fiery-Fenix
pushed a commit
to Fiery-Fenix/opentelemetry-collector-contrib
that referenced
this pull request
Apr 24, 2025
…elemetry#38862) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description After checking the component labels file, `COMPONENT` may be empty if the label added is not for a component. This is a valid and acceptable state. If the label does not correspond to a component, code owners don't need to be pinged. This is to fix the following [example failure](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/13994662160/job/39186701459). <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Related to open-telemetry#38622 Before the related PR the passed in component was checked to make sure it wasn't empty and passed directly to the `get-codeowners.sh` script, which fails if `COMPONENT` is empty, and returns an empty string successfully if the given label is not a component. After the change, `COMPONENT` is modified to potentially be empty, then passed to `get-codeowners.sh`. This is what caused the `1` return code. <!--Describe what testing was performed and which tests were added.--> #### Testing Tested locally with the label `os:windows`. The script passes with the change, failed before.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
To generate labels for all components, including those with paths longer than 50 characters:
In the root Makefile, a phony target is created to generate the .github/component_labels file, which contains the component paths and their corresponding labels (shortened paths for those exceeding 50 characters by removing repeated patterns in the string). The file is space-delimited.
In the build-and-test workflow, under the checks job, a step is added to verify that the .github/component_labels file exists.
The scripts used in the workflows are adjusted to use the .github/component_labels file as a reference for mappings between component paths and their labels.
Link to tracking issue
Fixes #38527