Skip to content

Commit

Permalink
[chore] detect gnu-sed (open-telemetry#37306)
Browse files Browse the repository at this point in the history
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

make `check-collector-module-version.sh` worked on macos with gnu-sed.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes
open-telemetry#37304

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->

Co-authored-by: Sean Marciniak <[email protected]>
  • Loading branch information
zirain and MovieStoreGuy authored Jan 22, 2025
1 parent de9aab3 commit 8034e0d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .github/workflows/scripts/check-collector-module-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ set -eu -o pipefail

mod_files=$(find . -type f -name "go.mod")

# Check if GNU sed is installed
GNU_SED_INSTALLED=false
if sed --version 2>/dev/null | grep -q "GNU sed"; then
GNU_SED_INSTALLED=true
fi

# Return the collector main core version
get_collector_version() {
collector_module="$1"
Expand All @@ -37,7 +43,7 @@ check_collector_versions_correct() {

# Loop through all the module files, checking the collector version
for mod_file in $mod_files; do
if [ "$(uname)" == "Darwin" ]; then
if [ "${GNU_SED_INSTALLED}" = false ]; then
sed -i '' "s|$collector_module [^ ]*|$collector_module $collector_mod_version|g" $mod_file
else
sed -i'' "s|$collector_module [^ ]*|$collector_module $collector_mod_version|g" $mod_file
Expand Down

0 comments on commit 8034e0d

Please sign in to comment.