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