097a46f527a172eb3d7bb5ee6571c154b993e68a
[osm/devops.git] / tools / newtag.sh
1 #!/bin/bash
2 if [ $# -ne 5 ]; then
3 echo "Usage $0 <repo> <branch> <tag> <user> <release_name>"
4 echo "Example: $0 all master v4.0.2 garciadeblas FOUR"
5 echo "Example: $0 devops v5.0 v5.0.3 marchettim FIVE"
6 exit 1
7 fi
8
9 BRANCH="$2"
10 TAG="$3"
11 USER="$4"
12 RELEASE_NAME="$5"
13 tag_header="OSM Release $RELEASE_NAME:"
14 tag_message="$tag_header version $TAG"
15
16 modules="common devops IM LCM LW-UI MON N2VC NBI openvim osmclient RO vim-emu POL"
17 list=""
18 for i in $modules; do
19 if [ "$1" == "$i" -o "$1" == "all" ]; then
20 list="$1"
21 break
22 fi
23 done
24
25 [ "$1" == "all" ] && list=$modules
26
27 if [ -z "$list" ]; then
28 echo "Repo must be one of these: $modules all"
29 exit 1
30 fi
31
32 for i in $list; do
33 echo $i
34 if [ ! -d $i ]; then
35 git clone ssh://$USER@osm.etsi.org:29418/osm/$i
36 fi
37 git -C $i checkout $BRANCH
38 git -C $i pull --rebase
39 git -C $i tag -a $TAG -m"$tag_message"
40 git -C $i push origin $TAG --follow-tags
41 sleep 2
42 done
43
44 exit 0