Last active
June 24, 2023 19:31
-
-
Save dims/bca6889ef2fab9479d6a6b4aa5f3a38b to your computer and use it in GitHub Desktop.
This file contains hidden or 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/bash | |
set -xeu | |
upd::pin(){ | |
local repo=$1 | |
local sha=$2 | |
hack/pin-dependency.sh $1 $2 | |
} | |
upd::commit() { | |
local message=$1 | |
hack/update-vendor.sh | |
git add Godeps/ vendor/ staging/ go.* | |
git commit -a -m "$message" | |
} | |
upd::update(){ | |
local repo=$1 | |
local sha=$2 | |
upd::pin $1 $2 | |
upd::commit "Updating dependency $1 to version $2" | |
} | |
upd::generated_files(){ | |
hack/update-generated-device-plugin.sh | |
hack/update-generated-kms.sh | |
hack/update-generated-kubelet-plugin-registration.sh | |
hack/update-generated-pod-resources.sh | |
hack/update-generated-protobuf.sh | |
hack/update-generated-runtime.sh | |
hack/update-generated-swagger-docs.sh | |
hack/update-generated-docs.sh | |
upd::commit "update generated files" | |
} | |
upd::update_lint_dependencies() { | |
while IFS= read -r line; do | |
IFS=' ' read -r -a array <<< "$line" | |
echo ">>>> Updating ${array[1]} to ${array[2]}" | |
upd::update "${array[1]}" "${array[2]}" | |
done < <(hack/lint-dependencies.sh | sort | grep " hack/pin-dependency.sh" | grep -v go-criu | sort) | |
} | |
upd::update_lint_golang_dependencies() { | |
while IFS= read -r line; do | |
IFS=' ' read -r -a array <<< "$line" | |
echo ">>>> Updating ${array[1]} to ${array[2]}" | |
upd::update "${array[1]}" "${array[2]}" | |
done < <(hack/lint-dependencies.sh --all | sort | grep " hack/pin-dependency.sh" | grep golang.org | grep -v -e sys -e tools -e net | sort) | |
} | |
upd::drop_unused_modules() { | |
while IFS= read -r line; do | |
bash -c "$line" | |
done < <(hack/lint-dependencies.sh | grep "go mod edit -dropreplace") | |
upd::commit "Remove pinned module versions that are not actually used" | |
} | |
# upd::pin github.com/google/cadvisor efa9742d7f7c | |
# upd::pin github.com/containerd/containerd v1.3.3 | |
# upd::commit 'Update cadvisor and containerd' | |
# upd::update sigs.k8s.io/yaml v1.2.0 | |
main() { | |
upd::update github.com/influxdb/influxdb 9eab56311373 | |
upd::pin github.com/google/cadvisor/ 8af10c6 | |
upd::pin github.com/containerd/containerd v1.3.3 | |
upd::commit 'Update cadvisor and containerd' | |
upd::update_lint_dependencies | |
upd::update_lint_dependencies | |
upd::update_lint_dependencies | |
upd::update_lint_dependencies | |
upd::update_lint_dependencies | |
upd::update_lint_dependencies | |
upd::update_lint_golang_dependencies | |
upd::update_lint_golang_dependencies | |
upd::update_lint_golang_dependencies | |
upd::drop_unused_modules | |
upd::generated_files | |
upd::drop_unused_modules | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment