verify-staging-meta-files.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/usr/bin/env bash
  2. # Copyright 2018 The Kubernetes Authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. set -o errexit
  16. set -o nounset
  17. set -o pipefail
  18. KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
  19. expected_filenames=(
  20. .github/PULL_REQUEST_TEMPLATE.md
  21. code-of-conduct.md
  22. LICENSE
  23. OWNERS
  24. README.md
  25. SECURITY_CONTACTS
  26. )
  27. exceptions=(
  28. client-go/README.md # client-go provides its own README
  29. )
  30. RESULT=0
  31. for full_repo_path in "${KUBE_ROOT}"/staging/src/k8s.io/*; do
  32. repo=$(basename "${full_repo_path}")
  33. for filename in "${expected_filenames[@]}"; do
  34. if echo " ${exceptions[*]} " | grep -F " ${repo}/${filename} " >/dev/null; then
  35. continue
  36. elif [ ! -f "${KUBE_ROOT}/staging/src/k8s.io/${repo}/${filename}" ]; then
  37. echo "staging/src/k8s.io/${repo}/${filename} does not exist and must be created"
  38. RESULT=1
  39. fi
  40. done
  41. done
  42. exit $RESULT