Add component version check for README.md (#9042)
During code-review, reviwers needed to take care of README.md also should be updated when the pull request updated component versions. This adds the corresponding check to reduce reviwer's burden.pull/9044/head
parent
4b03f6c20f
commit
6cd243f14e
|
@ -68,6 +68,13 @@ markdownlint:
|
|||
script:
|
||||
- markdownlint $(find . -name '*.md' | grep -vF './.git') --ignore docs/_sidebar.md --ignore contrib/dind/README.md
|
||||
|
||||
check-readme-versions:
|
||||
stage: unit-tests
|
||||
tags: [light]
|
||||
image: python:3
|
||||
script:
|
||||
- tests/scripts/check_readme_versions.sh
|
||||
|
||||
ci-matrix:
|
||||
stage: unit-tests
|
||||
tags: [light]
|
||||
|
|
|
@ -144,7 +144,7 @@ Note: Upstart/SysV init based OS types are not supported.
|
|||
- [calico](https://github.com/projectcalico/calico) v3.23.1
|
||||
- [canal](https://github.com/projectcalico/canal) (given calico/flannel versions)
|
||||
- [cilium](https://github.com/cilium/cilium) v1.11.3
|
||||
- [flanneld](https://github.com/flannel-io/flannel) v0.17.0
|
||||
- [flannel](https://github.com/flannel-io/flannel) v0.17.0
|
||||
- [kube-ovn](https://github.com/alauda/kube-ovn) v1.9.2
|
||||
- [kube-router](https://github.com/cloudnativelabs/kube-router) v1.5.0
|
||||
- [multus](https://github.com/intel/multus-cni) v3.8
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
TARGET_COMPONENTS="containerd calico cilium flannel kube-ovn kube-router weave cert-manager"
|
||||
|
||||
# cd to the root directory of kubespray
|
||||
cd $(dirname $0)/../../
|
||||
|
||||
echo checking kubernetes..
|
||||
version_from_default=$(grep "^kube_version:" ./roles/kubespray-defaults/defaults/main.yaml | awk '{print $2}' | sed s/\"//g)
|
||||
version_from_readme=$(grep " \[kubernetes\]" ./README.md | awk '{print $3}')
|
||||
if [ "${version_from_default}" != "${version_from_readme}" ]; then
|
||||
echo "The version of kubernetes is different between main.yml(${version_from_default}) and README.md(${version_from_readme})."
|
||||
echo "If the pull request updates kubernetes version, please updates README.md also."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for component in $(echo ${TARGET_COMPONENTS}); do
|
||||
echo checking ${component}..
|
||||
version_from_default=$(grep "^$(echo ${component} | sed s/"-"/"_"/)_version:" ./roles/download/defaults/main.yml | awk '{print $2}' | sed s/\"//g | sed s/^v//)
|
||||
version_from_readme=$(grep "\[${component}\]" ./README.md | grep "https" | awk '{print $3}' | sed s/^v//)
|
||||
if [ "${version_from_default}" != "${version_from_readme}" ]; then
|
||||
echo "The version of ${component} is different between main.yml(${version_from_default}) and README.md(${version_from_readme})."
|
||||
echo "If the pull request updates ${component} version, please updates README.md also."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Succeeded to check all components."
|
||||
exit 0
|
Loading…
Reference in New Issue