Created
February 4, 2021 10:03
-
-
Save iam-veeramalla/11aeb8dffab28d9bd594e3162b3b3184 to your computer and use it in GitHub Desktop.
Update Kubernetes version in go.mod
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
#!/bin/sh | |
set -euo pipefail | |
VERSION=${1#"v"} | |
if [ -z "$VERSION" ]; then | |
echo "Must specify version!" | |
exit 1 | |
fi | |
MODS=($( | |
curl -sS https://raw.githubusercontent.com/kubernetes/kubernetes/v${VERSION}/go.mod | | |
sed -n 's|.*k8s.io/\(.*\) => ./staging/src/k8s.io/.*|k8s.io/\1|p' | |
)) | |
for MOD in "${MODS[@]}"; do | |
V=$( | |
go mod download -json "${MOD}@kubernetes-${VERSION}" | | |
sed -n 's|.*"Version": "\(.*\)".*|\1|p' | |
) | |
go mod edit "-replace=${MOD}=${MOD}@${V}" | |
done | |
go get "k8s.io/kubernetes@v${VERSION}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment