update-all.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #!/bin/bash
  2. # Copyright 2014 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. # A single script that runs a predefined set of update-* scripts, as they often go together.
  16. set -o errexit
  17. set -o nounset
  18. set -o pipefail
  19. KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
  20. source "${KUBE_ROOT}/cluster/lib/util.sh"
  21. SILENT=true
  22. ALL=false
  23. while getopts ":va" opt; do
  24. case $opt in
  25. a)
  26. ALL=true
  27. ;;
  28. v)
  29. SILENT=false
  30. ;;
  31. \?)
  32. echo "Invalid flag: -$OPTARG" >&2
  33. exit 1
  34. ;;
  35. esac
  36. done
  37. trap 'exit 1' SIGINT
  38. if $SILENT ; then
  39. echo "Running in the silent mode, run with -v if you want to see script logs."
  40. fi
  41. if ! $ALL ; then
  42. echo "Running in short-circuit mode; run with -a to force all scripts to run."
  43. fi
  44. BASH_TARGETS="
  45. generated-protobuf
  46. codegen
  47. codecgen
  48. generated-docs
  49. generated-swagger-docs
  50. swagger-spec
  51. api-reference-docs"
  52. for t in $BASH_TARGETS
  53. do
  54. echo -e "${color_yellow}Updating $t${color_norm}"
  55. if $SILENT ; then
  56. if ! bash "$KUBE_ROOT/hack/update-$t.sh" 1> /dev/null; then
  57. echo -e "${color_red}Updating $t FAILED${color_norm}"
  58. if ! $ALL; then
  59. exit 1
  60. fi
  61. fi
  62. else
  63. if ! bash "$KUBE_ROOT/hack/update-$t.sh"; then
  64. echo -e "${color_red}Updating $t FAILED${color_norm}"
  65. if ! $ALL; then
  66. exit 1
  67. fi
  68. fi
  69. fi
  70. done
  71. echo -e "${color_green}Update scripts completed successfully${color_norm}"