Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- DIR_BUILD="$(whoami)/rtg-build"
- META_REPO=git@wrgitlab.int.net.nokia.com:rtg/rtg-build.git
- if [[ ${BUILD_TAG} == AUTO ]]; then
- AUTO_TAG=1
- fi
- if [[ ! $AUTO_TAG -eq 1 ]]; then
- if [[ ! $BUILD_TAG =~ RTG_RL[0-9]+\.[0-9]+_BLD-[0-9]+ ]]; then
- echo Error: BUILD_TAG must be in format RTG_RLX.X_BLD-X
- exit 1
- fi
- fi
- echo "Cleaning build directory $DIR_BUILD..."
- rm -rf "$DIR_BUILD"
- mkdir -p "$DIR_BUILD"
- cd "$DIR_BUILD" || exit 1
- git clone --branch master ${META_REPO} meta || { echo "error: git clone failed" && exit 1; }
- # Automatically determine build TAG
- if [[ $AUTO_TAG -eq 1 ]]; then
- LATEST_TAG=$(cd meta || exit; git tag -l "RTG_RL*_BLD-*" | sort -V | tail -1)
- 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); }')
- echo ""
- echo "Latest built tag: $LATEST_TAG"
- echo "I will build tag: $NEW_AUTO_TAG"
- BUILD_TAG=$NEW_AUTO_TAG;
- fi
- rm -rf meta
- echo "http://cfzcci.scm.nsn-rdnet.net/view/RTG/job/RTG.FLOW/buildWithParameters?token=RTG_build_token&tag=${BUILD_TAG}"
- #curl "http://cfzcci.scm.nsn-rdnet.net/view/RTG/job/RTG.FLOW/buildWithParameters?token=RTG_build_token&tag=${BUILD_TAG}"
- echo "Sended tag: $LATEST_TAG to SCM."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement