common.sh 1.3 KB

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