-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Implement N-1 support policy for Go versions #4655
Conversation
- Fixes #4653. Implements linter check for go versions. - Current files checked are all yml files in ./github/workflows/ and ./docker/Makefile. Signed-off-by: Harish Shan <[email protected]>
…olicy - Fixes #4653. Implements convenience script to update references of go version. - Current files checked are all yml files in ./github/workflows/ and ./docker/Makefile. Signed-off-by: Harish Shan <[email protected]>
Signed-off-by: Harish Shan <[email protected]>
Signed-off-by: Harish Shan <[email protected]>
README.md
Outdated
|
||
Starting with the release of Go 1.21, support for Go versions will be updated as follows: | ||
|
||
1. The first release after the release of a new Go minor version `N` will add build and tests steps for the new Go minor version. |
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 am not sure we want to promise that such changes will be precisely in the "next release after Go release". Let's change to a bit more flexible phrasing like "soon after Go release"
scripts/check-go-version.sh
Outdated
go_mod_version=$(grep -oP "go\s+\K$version_regex+" $go_mod_path) | ||
|
||
# Ensure go.mod uses go_latest_version - 1 | ||
if [ "${go_mod_version%.*}" != "${go_latest_version%.*}" ] || [ $((10#${go_latest_version#*.} - 10#${go_mod_version#*.})) != 1 ]; then |
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 don't think this is what we want. With this check the CI will start failing immediately after Go release, which is unfair to PR authors. My intention was that the script checks that all other build scripts are on some version N and the go.mod is on N-1, but N does not have to be latest. Latest can be printed, but not enforced. It should only be used in the update script.
scripts/update-go-version.sh
Outdated
@@ -0,0 +1,42 @@ | |||
#!/bin/bash |
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.
This file has a large overlap with the check script, they need to be in sync regarding all the places they check. It would make sense to combine them into one and have an optional "update" behavior. Eg check script can take -u flag, and update script simply calls 'check -u'
- Moved all logic into ./scripts/check-go-version.sh with optional update flag - check-go-version.sh does not enforce version N to be latest now - Update script now calls ./scripts/check-go-version.sh -u - Updated README Signed-off-by: Harish Shan <[email protected]>
Hi @yurishkuro , I have updated the scripts according. I'm wondering if the update script is required, since it just calls the check-go-version script with a flag. |
README.md
Outdated
Starting with the release of Go 1.21, support for Go versions will be updated as follows: | ||
|
||
1. Soon after the release of a new Go minor version `N`, updates will be made to the build and tests steps to accommodate the latest Go minor version. | ||
2. Soon after the release of a new Go minor version `N`, support for Go version `N-2` will be removed. |
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.
2. Soon after the release of a new Go minor version `N`, support for Go version `N-2` will be removed. | |
2. Soon after the release of a new Go minor version `N`, support for Go version `N-2` will be removed and version `N-1` will become the minimum required version. |
scripts/check-go-version.sh
Outdated
|
||
# If update, set go.mod version as latest version - 1 (N-1) | ||
if [ "$update" = true ]; then | ||
go_mod_updated="${go_latest_version%.*}.$((10#${go_latest_version#*.} - 1))" |
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.
why double parentheses in the 2nd part?
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.
go_mod_updated
is odd name, perhaps go_mod_desired
scripts/check-go-version.sh
Outdated
go_mod_path="./go.mod" | ||
go_mod_version=$(grep -oP "go\s+\K$version_regex+" $go_mod_path) | ||
|
||
# If update, set go.mod version as latest version - 1 (N-1) |
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.
could we add a parameter so that the version can be specified in the command line instead of always being inferred from the latest?
scripts/check-go-version.sh
Outdated
if [ "$update" = true ]; then | ||
if [ "${version_string##*: }" != "$go_latest_version" ]; then | ||
updated_version="${version_string%%:*}: ${go_latest_version}" | ||
sed -i "s/$version_string/$updated_version/g" "$build_script" |
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.
how do you know this will not update some other part of the file? E.g. some GH actions are included via hash, which could in theory match the string you're substituting
scripts/check-go-version.sh
Outdated
if [ "${go_alpine_version##*:}" != "$go_latest_version" ]; then | ||
sed -i "s/${go_alpine_version}/golang:${go_latest_version}/" "$alpine_makefile_path" | ||
{ | ||
printf "Build script: %-60s | Previous Go Version: %s | Updated Go Version: %s\n" "$alpine_makefile_path" "${go_alpine_version##*:}" "${go_latest_version}" |
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.
can you make a function for this?
scripts/check-go-version.sh
Outdated
fi | ||
|
||
# Ensure N-1 support policy | ||
if [ "$update" != true ]; then |
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.
this is not really making the code shorter, you still have completely independent code paths
scripts/update-go-version.sh
Outdated
@@ -0,0 +1,3 @@ | |||
#!/bin/bash | |||
|
|||
./scripts/check-go-version.sh -u |
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'm fine to drop this script
Codecov ReportPatch has no changes to coverable lines.
📢 Thoughts on this report? Let us know!. |
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
This did not fully resolve the ticket because there is no linter check, but let's first start with manual updates. |
Which problem is this PR solving?
Resolves #4653
Description of the changes
How was this change tested?
Checklist
jaeger
:make lint test
jaeger-ui
:yarn lint
andyarn test