You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.8 KiB

  1. #!/bin/bash
  2. set -e
  3. TARGET_COMPONENTS="containerd calico cilium flannel kube-ovn kube-router weave cert-manager krew helm metallb registry cephfs-provisioner rbd-provisioner aws-ebs-csi-plugin azure-csi-plugin cinder-csi-plugin gcp-pd-csi-plugin local-path-provisioner local-volume-provisioner kube-vip ingress-nginx"
  4. # cd to the root directory of kubespray
  5. cd $(dirname $0)/../../
  6. echo checking kubernetes..
  7. version_from_default=$(grep "^kube_version:" ./roles/kubespray-defaults/defaults/main.yaml | awk '{print $2}' | sed s/\"//g)
  8. version_from_readme=$(grep " \[kubernetes\]" ./README.md | awk '{print $3}')
  9. if [ "${version_from_default}" != "${version_from_readme}" ]; then
  10. echo "The version of kubernetes is different between main.yml(${version_from_default}) and README.md(${version_from_readme})."
  11. echo "If the pull request updates kubernetes version, please update README.md also."
  12. exit 1
  13. fi
  14. for component in $(echo ${TARGET_COMPONENTS}); do
  15. echo checking ${component}..
  16. version_from_default=$(grep "^$(echo ${component} | sed s/"-"/"_"/g)_version:" ./roles/download/defaults/main.yml | awk '{print $2}' | sed s/\"//g | sed s/^v//)
  17. if [ "${version_from_default}" = "" ]; then
  18. version_from_default=$(grep "^$(echo ${component} | sed s/"-"/"_"/g)_version:" ./roles/kubernetes/node/defaults/main.yml | awk '{print $2}' | sed s/\"//g | sed s/^v//)
  19. fi
  20. version_from_readme=$(grep "\[${component}\]" ./README.md | grep "https" | awk '{print $3}' | sed s/^v//)
  21. if [ "${version_from_default}" != "${version_from_readme}" ]; then
  22. echo "The version of ${component} is different between main.yml(${version_from_default}) and README.md(${version_from_readme})."
  23. echo "If the pull request updates ${component} version, please update README.md also."
  24. exit 1
  25. fi
  26. done
  27. echo "Succeeded to check all components."
  28. exit 0