Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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