-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add shell script to ensure consistent version of OTEL semconv #4652
Merged
yurishkuro
merged 4 commits into
jaegertracing:main
from
perhapsmaple:check-semconv-version
Aug 14, 2023
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ef45569
Add shell script to ensure consistent version of OTEL semconv
perhapsmaple 0f3c374
Add bash script to update all references of semconv to latest version…
perhapsmaple 35b30cf
Refactor shell scripts to address review
perhapsmaple efe85f3
Merge branch 'main' into check-semconv-version
perhapsmaple File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -10,12 +10,12 @@ done < <(find . -type f -name "*.go" -exec grep -o -H "go.opentelemetry.io/otel/ | |||||
semconv_versions=($(printf "%s\n" "${semconv_map[@]}" | sort -u)) | ||||||
|
||||||
if [ ${#semconv_versions[@]} -gt 1 ]; then | ||||||
echo "Error: semconv version mismatch detected" | ||||||
echo "Error: semconv version mismatch detected. Run ./scripts/update-semconv-version.sh to update semconv to latest version." | ||||||
{ | ||||||
for key in "${!semconv_map[@]}"; do | ||||||
printf "Source File: %-30s | Semconv Version: %s\n" "$key" "${semconv_map[$key]}" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
30 may not be long enough |
||||||
done | ||||||
} | column -t -s '|' | ||||||
|
||||||
exit 1 | ||||||
fi | ||||||
fi |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
latest_semconv_version=$( | ||
curl -s https://pkg.go.dev/go.opentelemetry.io/otel/semconv \ | ||
| grep -oP 'data-id="v\d+\.\d+\.\d+"' \ | ||
| sed -E 's/data-id="v([0-9]+\.[0-9]+\.[0-9]+)"/v\1/' \ | ||
| sort -Vr \ | ||
| head -n 1 | ||
) | ||
|
||
latest_package_string="go.opentelemetry.io/otel/semconv/$latest_semconv_version" | ||
|
||
while IFS=: read -r file_name package_string; do | ||
version_number=$(echo "$package_string" | grep -o -E "v1\.[0-9]+\.[0-9]+") | ||
|
||
if [ "$version_number" != "$latest_semconv_version" ]; then | ||
sed -i "s#go\.opentelemetry\.io\/otel\/semconv\/v[0-9]\+\.[0-9]\+\.[0-9]\+#$latest_package_string#g" "$file_name" | ||
{ | ||
printf "Source File: %-60s | Previous Semconv Version: %s | Updated Semconv Version: %s\n" "$file_name" "$version_number" "$latest_semconv_version" | ||
} | column -t -s '|' | ||
fi | ||
done < <(find . -type f -name "*.go" -exec grep -o -H "go.opentelemetry.io/otel/semconv/v1\.[0-9]\+\.[0-9]\+" {} +) |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend printing "Run <script>" line at the end of the output, after the listing of files.