Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.26 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. DIR_BUILD="$(whoami)/rtg-build"
  4. META_REPO=git@wrgitlab.int.net.nokia.com:rtg/rtg-build.git
  5.  
  6. if [[ ${BUILD_TAG} == AUTO ]]; then
  7.     AUTO_TAG=1
  8. fi
  9.  
  10. if [[ ! $AUTO_TAG -eq 1 ]]; then
  11.   if [[ ! $BUILD_TAG =~ RTG_RL[0-9]+\.[0-9]+_BLD-[0-9]+ ]]; then
  12.     echo Error: BUILD_TAG must be in format RTG_RLX.X_BLD-X
  13.     exit 1
  14.   fi
  15. fi
  16.  
  17. echo "Cleaning build directory $DIR_BUILD..."
  18. rm -rf "$DIR_BUILD"
  19. mkdir -p "$DIR_BUILD"
  20. cd "$DIR_BUILD" || exit 1
  21.  
  22. git clone --branch master ${META_REPO} meta || { echo "error: git clone failed" && exit 1; }
  23.  
  24. # Automatically determine build TAG
  25. if [[ $AUTO_TAG -eq 1 ]]; then
  26.     LATEST_TAG=$(cd meta || exit; git tag -l "RTG_RL*_BLD-*" | sort -V | tail -1)
  27.     NEW_AUTO_TAG=$(echo "$LATEST_TAG" | awk '{ if (match($0, /(RTG_RL[0-9]+\.[0-9]+_BLD-)([0-9]+)/, m)) printf("%s%02d", m[1], m[2] + 1); }')
  28.     echo ""
  29.     echo "Latest built tag: $LATEST_TAG"
  30.     echo "I will build tag: $NEW_AUTO_TAG"
  31.     BUILD_TAG=$NEW_AUTO_TAG;
  32. fi
  33. rm -rf meta
  34.  
  35. echo "http://cfzcci.scm.nsn-rdnet.net/view/RTG/job/RTG.FLOW/buildWithParameters?token=RTG_build_token&tag=${BUILD_TAG}"
  36. #curl "http://cfzcci.scm.nsn-rdnet.net/view/RTG/job/RTG.FLOW/buildWithParameters?token=RTG_build_token&tag=${BUILD_TAG}"
  37. echo "Sended tag: $LATEST_TAG to SCM."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement