|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Copyright 2025 The Kubernetes Authors. |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +set -o errexit |
| 18 | +set -o nounset |
| 19 | +set -o pipefail |
| 20 | + |
| 21 | +# start at the root of the repo |
| 22 | +REPO_ROOT="$(git rev-parse --show-toplevel)" |
| 23 | +cd "${REPO_ROOT}" |
| 24 | + |
| 25 | +# Go through all our modules and update them to the latest version |
| 26 | +# We exclude a few dependencies |
| 27 | +# IDEA: Can we create a tool that will make this easier? Make like a .upgrade-deps.yaml or .codebots.yaml file in each module? |
| 28 | + |
| 29 | +cd "${REPO_ROOT}" |
| 30 | +go get $(go list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -mod=mod -m all | grep -v spotinst-sdk-go) |
| 31 | + |
| 32 | +cd "${REPO_ROOT}/hack" |
| 33 | +go get $(go list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -mod=mod -m all) |
| 34 | + |
| 35 | +cd "${REPO_ROOT}/tests/e2e" |
| 36 | +go get $(go list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -mod=mod -m all | grep -v kubetest2) |
| 37 | + |
| 38 | +cd "${REPO_ROOT}/tools/otel/traceserver" |
| 39 | +go get $(go list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -mod=mod -m all) |
| 40 | + |
| 41 | +# Tidy go modules |
| 42 | +cd "${REPO_ROOT}" |
| 43 | +make gomod |
| 44 | + |
| 45 | +if $(git diff --quiet); then |
| 46 | + echo "No changes" |
| 47 | +else |
| 48 | + git add . |
| 49 | + git commit -m "codebot: update-dependencies" |
| 50 | + echo "Updated dependencies" |
| 51 | +fi |
0 commit comments