Skip to content

Conversation

@henrybear327
Copy link
Contributor

@henrybear327 henrybear327 commented Sep 19, 2024

Based on the experience of performing dependency bumps, some minor improvements are made to the script to make it conform to our current dependency bump procedure, listed as follows:

  • print out the dependency's version before and after the bump
  • check if the dependency is fully indirect
  • change the behavior of bumping dependency (doesn't ignore bumping indirect dependency in the go mod files anymore)
  • check if all dependencies across all go mod files have the same pinned version respectively after bumping a dependency

Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.

@henrybear327
Copy link
Contributor Author

/cc @ivanvc
/cc @ahrtr
I am not good with bash scripts :(

This is the script that I have been using to bump the dependencies in the past months. Hopefully, it will be helpful for future volunteers before the dependabot is fixed!

@ivanvc
Copy link
Member

ivanvc commented Sep 19, 2024

@henrybear327, there are some shellcheck warnings in the script. Would you want to draft the PR? And would you like me to continue on top of it? Or do you want to address the issues?

@henrybear327
Copy link
Contributor Author

@henrybear327, there are some shellcheck warnings in the script. Would you want to draft the PR? And would you like me to continue on top of it? Or do you want to address the issues?

@ivanvc let's draft the PR and you can probably take over it if you have time to improve it!

Hopefully it's a helpful start otherwise you can trash the PR and start from scratch!

Thanks!

@codecov-commenter
Copy link

codecov-commenter commented Sep 19, 2024

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.51%. Comparing base (5e543d7) to head (08decca).

Additional details and impacted files

see 21 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #18609      +/-   ##
==========================================
+ Coverage   68.44%   68.51%   +0.07%     
==========================================
  Files         429      429              
  Lines       35203    35203              
==========================================
+ Hits        24093    24121      +28     
+ Misses       9709     9682      -27     
+ Partials     1401     1400       -1     

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5e543d7...08decca. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@henrybear327
Copy link
Contributor Author

@henrybear327, there are some shellcheck warnings in the script. Would you want to draft the PR? And would you like me to continue on top of it? Or do you want to address the issues?

@ivanvc I have fixed the shellcheck errors

Maybe you can see if this is a good enough quality script to consider now!
Thank you!

@henrybear327 henrybear327 force-pushed the ci/improve_update_dep branch 2 times, most recently from 967bc31 to f892b05 Compare September 25, 2024 07:33
@henrybear327 henrybear327 marked this pull request as draft September 25, 2024 07:55
Copy link
Member

@ivanvc ivanvc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request, Henry. I haven't had a chance to check it before. I left some comments ✌️

@henrybear327 henrybear327 force-pushed the ci/improve_update_dep branch 3 times, most recently from 1e47ce2 to 97d9610 Compare October 8, 2024 17:36
@henrybear327 henrybear327 force-pushed the ci/improve_update_dep branch 2 times, most recently from 401bceb to 612ca28 Compare October 27, 2024 03:33
@henrybear327 henrybear327 force-pushed the ci/improve_update_dep branch from 8af5f84 to 340a0bb Compare October 8, 2025 21:38
@henrybear327
Copy link
Contributor Author

This is looking like a great improvement. It also works great. I left a minimal suggestion for an improvement :)

Thanks for reviewing it! :)

Copy link
Member

@ivanvc ivanvc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Henry. Thanks for putting this together. I used your script to do this week's dependency management. After enabling the workspace, as we mentioned before, it's not required to run make fix for each module. Running it at the end should be enough.

Also, ./scripts/fix.sh doesn't exist anymore. I left as suggestions the local edits I did to make it work.

@henrybear327 henrybear327 force-pushed the ci/improve_update_dep branch 3 times, most recently from c6a84c8 to 2b5ddcc Compare December 1, 2025 20:58
@henrybear327
Copy link
Contributor Author

All comments addressed! Thanks to @ivanvc and @joshjms for the review!

@henrybear327 henrybear327 force-pushed the ci/improve_update_dep branch 2 times, most recently from 68d11d2 to d1ad187 Compare December 4, 2025 20:56
@henrybear327 henrybear327 force-pushed the ci/improve_update_dep branch 2 times, most recently from 9d079a4 to 61c1af3 Compare December 10, 2025 09:51
@henrybear327
Copy link
Contributor Author

/retest

1 similar comment
@henrybear327
Copy link
Contributor Author

/retest

@henrybear327
Copy link
Contributor Author

/retest

Copy link
Member

@ivanvc ivanvc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I used to do the dependencies bump from #21049.

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: henrybear327, ivanvc

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ivanvc
Copy link
Member

ivanvc commented Dec 23, 2025

/cc @ahrtr

@k8s-ci-robot
Copy link

k8s-ci-robot commented Dec 23, 2025

@henrybear327: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci-etcd-robustness-release36-amd64 190eb93 link true /test ci-etcd-robustness-release36-amd64

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@henrybear327
Copy link
Contributor Author

/retest

@ahrtr
Copy link
Member

ahrtr commented Dec 23, 2025

Please ensure the script works on both Mac OS and Linux. The following is the output from my Mac OS.

Minor comment: Also I do not see the log_info "Updating ${mod} to version ${ver} in $(module_subdir)...". The duplication of log Adding 'github.com/olekukonko/tablewriter' to go.mod for update. just creates too many noise.

$ ./scripts/update_dep.sh github.com/olekukonko/tablewriter v1.1.2
github.com/olekukonko/tablewriter version in all go.mod files:
./etcdutl/go.mod		github.com/olekukonko/tablewriter v1.1.1
./go.mod		github.com/olekukonko/tablewriter v1.1.1 // indirect
./etcdctl/go.mod		github.com/olekukonko/tablewriter v1.1.1
./tests/go.mod		github.com/olekukonko/tablewriter v1.1.1

Adding 'github.com/olekukonko/tablewriter' to go.mod for update.
% (cd api && 'go' 'mod' 'edit' '-require' 'github.com/olekukonko/tablewriter@v1.1.2')
Adding 'github.com/olekukonko/tablewriter' to go.mod for update.
% (cd pkg && 'go' 'mod' 'edit' '-require' 'github.com/olekukonko/tablewriter@v1.1.2')
Adding 'github.com/olekukonko/tablewriter' to go.mod for update.
% (cd client/pkg && 'go' 'mod' 'edit' '-require' 'github.com/olekukonko/tablewriter@v1.1.2')
Adding 'github.com/olekukonko/tablewriter' to go.mod for update.
% (cd client/v3 && 'go' 'mod' 'edit' '-require' 'github.com/olekukonko/tablewriter@v1.1.2')
Adding 'github.com/olekukonko/tablewriter' to go.mod for update.
% (cd server && 'go' 'mod' 'edit' '-require' 'github.com/olekukonko/tablewriter@v1.1.2')
Adding 'github.com/olekukonko/tablewriter' to go.mod for update.
% (cd etcdutl && 'go' 'mod' 'edit' '-require' 'github.com/olekukonko/tablewriter@v1.1.2')
Adding 'github.com/olekukonko/tablewriter' to go.mod for update.
% (cd etcdctl && 'go' 'mod' 'edit' '-require' 'github.com/olekukonko/tablewriter@v1.1.2')
Adding 'github.com/olekukonko/tablewriter' to go.mod for update.
% (cd tests && 'go' 'mod' 'edit' '-require' 'github.com/olekukonko/tablewriter@v1.1.2')
Adding 'github.com/olekukonko/tablewriter' to go.mod for update.
% (cd tools/mod && 'go' 'mod' 'edit' '-require' 'github.com/olekukonko/tablewriter@v1.1.2')
Adding 'github.com/olekukonko/tablewriter' to go.mod for update.
% (cd tools/rw-heatmaps && 'go' 'mod' 'edit' '-require' 'github.com/olekukonko/tablewriter@v1.1.2')
Adding 'github.com/olekukonko/tablewriter' to go.mod for update.
% (cd tools/testgrid-analysis && 'go' 'mod' 'edit' '-require' 'github.com/olekukonko/tablewriter@v1.1.2')
Adding 'github.com/olekukonko/tablewriter' to go.mod for update.
% (cd cache && 'go' 'mod' 'edit' '-require' 'github.com/olekukonko/tablewriter@v1.1.2')
Adding 'github.com/olekukonko/tablewriter' to go.mod for update.
% 'go' 'mod' 'edit' '-require' 'github.com/olekukonko/tablewriter@v1.1.2'
PASSES="mod_tidy_fix" ./scripts/test.sh
go: downloading github.com/olekukonko/tablewriter v1.1.2
go: downloading github.com/clipperhouse/uax29/v2 v2.3.0
go: downloading github.com/olekukonko/ll v0.1.3
go: downloading github.com/clipperhouse/displaywidth v0.6.0
Running with --race
Starting at: Tue 23 Dec 2025 10:49:56 GMT

'mod_tidy_fix' started at Tue 23 Dec 2025 10:49:56 GMT
% 'rm' './go.sum'
% 'go' 'mod' 'tidy'
% (cd api && 'rm' './go.sum')
% (cd api && 'go' 'mod' 'tidy')
% (cd cache && 'rm' './go.sum')
% (cd cache && 'go' 'mod' 'tidy')
% (cd client/pkg && 'rm' './go.sum')
% (cd client/pkg && 'go' 'mod' 'tidy')
% (cd client/v3 && 'rm' './go.sum')
% (cd client/v3 && 'go' 'mod' 'tidy')
% (cd etcdctl && 'rm' './go.sum')
% (cd etcdctl && 'go' 'mod' 'tidy')
% (cd etcdutl && 'rm' './go.sum')
% (cd etcdutl && 'go' 'mod' 'tidy')
% (cd pkg && 'rm' './go.sum')
% (cd pkg && 'go' 'mod' 'tidy')
% (cd server && 'rm' './go.sum')
% (cd server && 'go' 'mod' 'tidy')
% (cd tests && 'rm' './go.sum')
% (cd tests && 'go' 'mod' 'tidy')
% (cd tools/mod && 'rm' './go.sum')
% (cd tools/mod && 'go' 'mod' 'tidy')
% (cd tools/rw-heatmaps && 'rm' './go.sum')
% (cd tools/rw-heatmaps && 'go' 'mod' 'tidy')
% (cd tools/testgrid-analysis && 'rm' './go.sum')
% (cd tools/testgrid-analysis && 'go' 'mod' 'tidy')
'mod_tidy_fix' PASSED and completed at Tue 23 Dec 2025 10:49:58 GMT
SUCCESS
./scripts/updatebom.sh
generating bill-of-materials.json
% (cd tools/mod && 'go' 'install' 'github.com/appscodelabs/license-bill-of-materials')
% '/Users/wachao/go/bin/license-bill-of-materials' '--override-file' './bill-of-materials.override.json' './...' './api/...' './cache/...' './client/pkg/...' './client/v3/...' './etcdctl/...' './etcdutl/...' './pkg/...' './server/...' './tests/...'
bom refreshed
./scripts/verify_golangci-lint_version.sh
golangci-lint version: v2.6.2
different golangci-lint version installed: v2.5.0
Installing golangci-lint v2.6.2
golangci/golangci-lint info checking GitHub for tag 'v2.6.2'
golangci/golangci-lint info found version: 2.6.2 for v2.6.2/darwin/arm64
golangci/golangci-lint info installed /Users/wachao/go/bin/golangci-lint
golangci-lint version: v2.6.2
PASSES="lint_fix" ./scripts/test.sh
Running with --race
Starting at: Tue 23 Dec 2025 10:50:14 GMT

'lint_fix' started at Tue 23 Dec 2025 10:50:14 GMT
% 'golangci-lint' 'run' '--config' '/Users/wachao/go/src/github.com/henrybear327/etcd/tools/.golangci.yaml' '--fix' './...' './api/...' './cache/...' './client/pkg/...' './client/v3/...' './etcdctl/...' './etcdutl/...' './pkg/...' './server/...' './tests/...' './tools/mod/...' './tools/rw-heatmaps/...' './tools/testgrid-analysis/...'
0 issues.
'lint_fix' PASSED and completed at Tue 23 Dec 2025 10:51:31 GMT
SUCCESS
./scripts/fix/yamllint.sh
% (cd tools/mod && 'go' 'install' 'github.com/google/yamlfmt/cmd/yamlfmt')
% '/Users/wachao/go/bin/yamlfmt' '-conf' '/Users/wachao/go/src/github.com/henrybear327/etcd/tools/.yamlfmt' '.'
./scripts/sync_go_toolchain_directive.sh
./scripts/update_go_workspace.sh
sed: 1: "1i\// This is a generat ...": extra characters after \ at the end of i command
make: *** [update-go-workspace] Error 1

@ahrtr
Copy link
Member

ahrtr commented Dec 23, 2025

Please also update https://github.com/etcd-io/etcd/blob/main/Documentation/contributor-guide/dependency_management.md to clarify how this script should be used. Please keep the existing manual steps to bump each dependency, just add an alternative way to bump dependency using this script.

@henrybear327
Copy link
Contributor Author

Thanks for the feedback @ahrtr ^_^

Sorry that I didn't test it on MacOS at all since I wasn't aware we need to support that, too (the sed issue is a very classic one to have...)
I will make the changes accordingly! :)

Based on the experience of performing dependency bumps, some minor
improvements are made to the script to make it conform to our current
dependency bump procedure, listed as follows:
- print out the dependency's version before and after the bump
- check if the dependency is fully indirect
- change the behavior of bumping dependency (doesn't ignore bumping
indirect dependency in the go mod files anymore)
- check if all dependencies across all go mod files have the same pinned
version respectively after bumping a dependency

Signed-off-by: Chun-Hung Tseng <henrybear327@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

6 participants