Skip to content

Commit 8034e0d

Browse files
[chore] detect gnu-sed (#37306)
<!--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. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes #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]>
1 parent de9aab3 commit 8034e0d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.github/workflows/scripts/check-collector-module-version.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ set -eu -o pipefail
1414

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

17+
# Check if GNU sed is installed
18+
GNU_SED_INSTALLED=false
19+
if sed --version 2>/dev/null | grep -q "GNU sed"; then
20+
GNU_SED_INSTALLED=true
21+
fi
22+
1723
# Return the collector main core version
1824
get_collector_version() {
1925
collector_module="$1"
@@ -37,7 +43,7 @@ check_collector_versions_correct() {
3743

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

0 commit comments

Comments
 (0)