get_release_name.sh 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/bash
  2. # Licensed to the LF AI & Data foundation under one
  3. # or more contributor license agreements. See the NOTICE file
  4. # distributed with this work for additional information
  5. # regarding copyright ownership. The ASF licenses this file
  6. # to you under the Apache License, Version 2.0 (the
  7. # "License"); you may not use this file except in compliance
  8. # with the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. # Exit immediately for non zero status
  18. set -e
  19. # Check unset variables
  20. set -u
  21. # Print commands
  22. set -x
  23. function milvus_ci_release_name(){
  24. # Rules for helm release name
  25. local name="m"
  26. if [[ "${MILVUS_SERVER_TYPE:-}" == "distributed-pulsar" ]]; then
  27. # Distributed pulsar mode
  28. name+="dp"
  29. elif [[ "${MILVUS_SERVER_TYPE:-}" == "distributed-kafka" ]]; then
  30. # Distributed kafka mode
  31. name+="dk"
  32. elif [[ "${MILVUS_SERVER_TYPE:-}" == "standalone-kafka-mmap" ]]; then
  33. # Standalone kafka mode
  34. name+="sk"
  35. elif [[ "${MILVUS_SERVER_TYPE:-}" == "distributed" ]]; then
  36. # Distributed mode
  37. name+="d"
  38. elif [[ "${MILVUS_SERVER_TYPE:-}" == "standalone-authentication" ]]; then
  39. # Standalone authentication mode
  40. name+="a"
  41. elif [[ "${MILVUS_SERVER_TYPE:-}" == "standalone-one-pod" ]]; then
  42. # Standalone mode with one pod
  43. name+="sop"
  44. else
  45. # Standalone mode
  46. name+="s"
  47. fi
  48. # Add pr number into release name
  49. if [[ -n ${CHANGE_ID:-} ]]; then
  50. name+="-${CHANGE_ID:-}"
  51. fi
  52. # Add Jenkins BUILD_ID into Name
  53. if [[ -n ${JENKINS_BUILD_ID:-} ]]; then
  54. name+="-${JENKINS_BUILD_ID}"
  55. fi
  56. if [[ "${CI_MODE:-}" == "nightly" ]]; then
  57. # Nightly CI
  58. name+="-n"
  59. else
  60. # Pull Request CI
  61. name+="-pr"
  62. fi
  63. if [[ "${MODE:-}" == "gpu" ]]; then
  64. name+="-gpu"
  65. fi
  66. export MILVUS_HELM_RELEASE_NAME=${name}
  67. echo ${name}
  68. }
  69. milvus_ci_release_name