common.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/usr/bin/env bash
  2. DOCKERHUEBASE_VERSION=8.5.7
  3. DOCKERHUELB_VERSION=2.5.7
  4. REBUILD_BASE=1
  5. HUEUSER="hive"
  6. CONTAINER=$(uuidgen | cut -d"-" -f5)
  7. reset_git_state() {
  8. cd $HUE_SRC
  9. git clean -fdx
  10. }
  11. find_git_state() {
  12. cd $HUE_SRC
  13. export GBRANCH=$(git ls-remote --get-url)"/commits/"$(git rev-parse --abbrev-ref HEAD)
  14. export GSHA=$(git ls-remote --get-url)"/commit/"$(git rev-list --no-walk HEAD)
  15. export VERSION=$(grep "VERSION=" VERSION | cut -d"=" -f2 | cut -d'"' -f2)
  16. echo "GBRANCH=$GBRANCH" >> hue.version
  17. echo "GSHA=$GSHA" >> hue.version
  18. echo "VERSION=$VERSION" >> hue.version
  19. echo "GBN=$GBN" >> hue.version
  20. }
  21. find_extra_container_to_build() {
  22. cd $HUE_SRC
  23. workdir=""
  24. projects=$(find $HUE_SRC -path "*/tools/container/build.sh")
  25. skip_dir=$(dirname $(readlink -f build.sh))
  26. for proj in $(find $HUE_SRC -path "*/tools/container/build.sh"); do
  27. if [[ "$proj" != "$skip_dir/build.sh" ]] && [[ "$proj" != "$HUE_SRC/tools/container/build.sh" ]]; then
  28. workdir=${proj}
  29. fi
  30. done
  31. echo $workdir
  32. }
  33. subst_var() {
  34. file_name=$1
  35. if [[ -e $file_name ]]; then
  36. if [[ "$file_name" == *"_template" ]]; then
  37. out_name="${file_name::-9}.conf"
  38. fi
  39. fi
  40. eval "cat <<EOF
  41. $(<$file_name)
  42. EOF
  43. " | tee $out_name 2> /dev/null
  44. }
  45. if [ -z "$REGISTRY" ]; then
  46. REGISTRY=${REGISTRY:-"docker.io/hortonworks"}
  47. fi