update-bindata.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. # Copyright 2016 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 pipefail
  17. set -o nounset
  18. if [[ -z "${KUBE_ROOT:-}" ]]; then
  19. # Relative to test/e2e/generated/
  20. KUBE_ROOT="../../../"
  21. fi
  22. source "${KUBE_ROOT}/cluster/lib/logging.sh"
  23. if [[ ! -d "${KUBE_ROOT}/examples" ]]; then
  24. echo "${KUBE_ROOT}/examples not detected. This script should be run from a location where the source dirs are available."
  25. exit 1
  26. fi
  27. if ! which go-bindata &>/dev/null ; then
  28. echo "Cannot find go-bindata. Install with"
  29. echo " go get -u github.com/jteeuwen/go-bindata/go-bindata"
  30. exit 5
  31. fi
  32. BINDATA_OUTPUT="${KUBE_ROOT}/test/e2e/generated/bindata.go"
  33. go-bindata -nometadata -prefix "${KUBE_ROOT}" -o ${BINDATA_OUTPUT} -pkg generated \
  34. -ignore .jpg -ignore .png -ignore .md \
  35. "${KUBE_ROOT}/examples/..." \
  36. "${KUBE_ROOT}/docs/user-guide/..." \
  37. "${KUBE_ROOT}/test/e2e/testing-manifests/..." \
  38. "${KUBE_ROOT}/test/images/..." \
  39. "${KUBE_ROOT}/test/fixtures/..."
  40. gofmt -s -w ${BINDATA_OUTPUT}
  41. V=2 kube::log::info "Generated bindata file : $(wc -l ${BINDATA_OUTPUT}) lines of lovely automated artifacts"