Skip to content

Commit

Permalink
CA: update-deps.sh: move tidy after all gets
Browse files Browse the repository at this point in the history
There doesn't seem to be any benefit to tidying after
getting every dependency pkg. And trying to tidy after
every get seems bugged:

* Some of the k8s.io dependencies depend on each other.
  For example k8s.io/client-go depends on k8s.io/api.
* We bump k8s.io/api to a new version, and that version removes
  some pkg (e.g. replaces v1alpha1 with v1alpha2), that
  some other dependency (e.g. k8s.io/client-go) requires.
* If we try to tidy immediately after getting k8s.io/api, this can
  fail because the required new k8s.io/api version doesn't have the
  removed pkg that k8s.io/client-go (still at a lower version
  since we haven't processed it yet) requires.

Getting all of the dependencies at the new versions first, and then
tidying once afterwards solves this issue.
  • Loading branch information
towca committed Nov 27, 2024
1 parent 29ce5d4 commit 5df68a4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cluster-autoscaler/hack/update-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ cluster_autoscaler:update_deps() {
go mod edit "-replace=${mod}=${mod}@${mod_version}"
else
go get "${mod}@${mod_version}"
go mod tidy
fi
done

go mod tidy

if [ "${pkg}" = "./cluster-autoscaler" ]; then
go get "k8s.io/kubernetes@v${k8s_version}"
go mod tidy
Expand Down

0 comments on commit 5df68a4

Please sign in to comment.