push-ci-build.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. # Pushes a continuous integration build to our official CI repository
  16. set -o errexit
  17. set -o nounset
  18. set -o pipefail
  19. KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
  20. source "${KUBE_ROOT}/build/util.sh"
  21. LATEST=$(kube::release::semantic_version)
  22. KUBE_GCS_NO_CACHING='n'
  23. KUBE_GCS_MAKE_PUBLIC='y'
  24. KUBE_GCS_UPLOAD_RELEASE='y'
  25. KUBE_GCS_DELETE_EXISTING='n'
  26. : ${KUBE_GCS_RELEASE_BUCKET:='kubernetes-release-dev'}
  27. KUBE_GCS_RELEASE_PREFIX="ci/${LATEST}"
  28. KUBE_GCS_PUBLISH_VERSION="${LATEST}"
  29. : ${KUBE_GCS_UPDATE_LATEST:='y'}
  30. source "${KUBE_ROOT}/build/common.sh"
  31. MAX_ATTEMPTS=3
  32. attempt=0
  33. while [[ ${attempt} -lt ${MAX_ATTEMPTS} ]]; do
  34. if [[ "${KUBE_GCS_UPDATE_LATEST}" =~ ^[yY]$ ]]; then
  35. kube::release::gcs::release && kube::release::gcs::publish_ci && break || true
  36. else
  37. kube::release::gcs::release && break || true
  38. fi
  39. attempt=$((attempt + 1))
  40. sleep 5
  41. done
  42. if [[ ! ${attempt} -lt ${MAX_ATTEMPTS} ]];then
  43. kube::log::error "Max attempts reached. Will exit."
  44. exit 1
  45. fi
  46. if [[ "${FEDERATION:-}" == "true" ]];then
  47. "${KUBE_ROOT}/build/push-federation-images.sh"
  48. fi