sigs.k8s.io/kubebuilder/v3@v3.14.0/hack/docs/check.sh (about) 1 #!/usr/bin/env bash 2 3 # Copyright 2023 The Kubernetes Authors. 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 check_directory="$(dirname "$0")/../../docs/book/src/" 18 19 # Check docs directory first. If there are any uncommitted change, fail the test. 20 if [[ $(git status ${check_directory} --porcelain) ]]; then 21 echo "Generate Docs test precondition failed!" 22 echo "Please commit the change under docs directory before running the Generate Docs test" 23 exit 1 24 fi 25 26 27 $(dirname "$0")/generate.sh 28 29 # Check if there are any changes to files under testdata directory. 30 if [[ $(git status ${check_directory} --porcelain) ]]; then 31 git status ${check_directory} --porcelain 32 git diff ${check_directory} 33 echo "Generate Docs failed!" 34 echo "Please, if you have changed the scaffolding make sure you have run: make generate" 35 exit 1 36 else 37 echo "Generate Docs passed!" 38 fi