Initial scripts that can drive creation and removal of tags 03/1303/3
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 15 Mar 2017 17:49:15 +0000 (18:49 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 6 Apr 2017 20:48:37 +0000 (22:48 +0200)
Change-Id: I71d24ae533e2131ea6690d20a5185ae47fa3b085
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
jenkins/release/delete-tag.sh [new file with mode: 0755]
jenkins/release/new-tag.sh [new file with mode: 0755]

diff --git a/jenkins/release/delete-tag.sh b/jenkins/release/delete-tag.sh
new file mode 100755 (executable)
index 0000000..358d680
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+HERE=$(realpath $(dirname $0))
+OSM_JENKINS=$(dirname $HERE)
+echo $OSM_JENKINS
+. $OSM_JENKINS/common/all_funcs
+
+[ $# -ne 1 ] && FATAL "arg1 is tag to be deleted"
+
+TAG="$1"
+
+TEMPDIR="$(mktemp -q -d --tmpdir "tagosm.XXXXXX")"
+trap 'rm -rf "$TEMPDIR"' EXIT
+
+list="juju-charms devops descriptor-packages openvim RO SO UI"
+for i in $list; do
+    REPO_FOLDER="$TEMPDIR/$i"
+    echo
+    echo "Cloning $i"
+    #git -C $TEMPDIR clone ssh://garciadeblas@osm.etsi.org:29418/osm/$i
+    git -C $REPO_FOLDER tag -d $TAG
+    git -C $REPO_FOLDER push origin :refs/tags/$TAG
+    sleep 2
+    rm -rf $REPO_FOLDER
+done
+
diff --git a/jenkins/release/new-tag.sh b/jenkins/release/new-tag.sh
new file mode 100755 (executable)
index 0000000..37c5193
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/bash
+HERE=$(realpath $(dirname $0))
+OSM_JENKINS=$(dirname $HERE)
+echo $OSM_JENKINS
+. $OSM_JENKINS/common/all_funcs
+
+[ $# -ne 2 ] && FATAL "arg1 is branch, arg2 is new tag"
+
+#CURRENT_BRANCH="v1.1"
+#TAG="v1.1.0"
+CURRENT_BRANCH="$1"
+TAG="$2"
+
+#tag_header="OSM Release ONE:"
+tag_header="OSM"
+tag_message="$tag_header version $TAG"
+
+TEMPDIR="$(mktemp -q -d --tmpdir "tagosm.XXXXXX")"
+trap 'rm -rf "$TEMPDIR"' EXIT
+#chmod 0600 "$TEMPDIR"
+
+#juju-charms and devops repos have no vx.y branch yet
+list="juju-charms devops"
+for i in $list; do
+    REPO_FOLDER="$TEMPDIR/$i"
+    echo
+    echo "Cloning and tagging $i"
+    #git -C $TEMPDIR clone ssh://garciadeblas@osm.etsi.org:29418/osm/$i
+    git -C $REPO_FOLDER checkout master
+    git -C $REPO_FOLDER tag -a $TAG -m"$tag_message"
+    git -C $REPO_FOLDER push origin $TAG --follow-tags
+    sleep 2
+    rm -rf $REPO_FOLDER
+done
+
+list="descriptor-packages openvim RO SO UI"
+for i in $list; do
+    REPO_FOLDER="$TEMPDIR/$i"
+    echo
+    echo "Cloning and tagging $i"
+    #git -C $TEMPDIR clone ssh://garciadeblas@osm.etsi.org:29418/osm/$i
+    git -C $REPO_FOLDER checkout $CURRENT_BRANCH
+    git -C $REPO_FOLDER tag -a $TAG -m"$tag_message"
+    git -C $REPO_FOLDER push origin $TAG --follow-tags
+    sleep 2
+    rm -rf $REPO_FOLDER
+done
+