Enable pushing tagged releases of VOLTHA 1.x to Docker Hub

Change-Id: I752d3d0157e43b3dcd47e952d338b041789f0267
diff --git a/jjb/pipeline/voltha-publish.groovy b/jjb/pipeline/voltha-publish.groovy
index a07d4f2..4d3e65a 100644
--- a/jjb/pipeline/voltha-publish.groovy
+++ b/jjb/pipeline/voltha-publish.groovy
@@ -29,17 +29,18 @@
     stage('build'){
       steps {
         sh """
-           #!/usr/bin/env bash
+          #!/usr/bin/env bash
 
-           pushd cord/incubator/voltha
-           if [ "${params.manifestBranch}" != "master" ]
-           then
-             VOLTHA_BUILD=docker DOCKER_CACHE_ARG=--no-cache TAG=${params.manifestBranch} make build
-           else
-             VOLTHA_BUILD=docker DOCKER_CACHE_ARG=--no-cache make build
-           fi
-           popd
-           """
+          pushd cord/incubator/voltha
+          if [ "${params.manifestBranch}" == "master" ]
+          then
+            tag="latest"
+          else
+            tag="${params.manifestBranch}"
+          fi
+          VOLTHA_BUILD=docker DOCKER_CACHE_ARG=--no-cache TAG=${tag} make build
+          popd
+          """
       }
     }
 
@@ -50,11 +51,18 @@
             #!/usr/bin/env bash
 
             pushd cord/incubator/voltha
-            if [ "${params.manifestBranch}" != "master" ]
+            if [ "${params.manifestBranch}" == "master" ]
             then
-              VOLTHA_BUILD=docker TAG=${params.manifestBranch} TARGET_REPOSITORY=voltha/ TARGET_TAG=${params.manifestBranch} make push
+              tag="latest"
             else
-              VOLTHA_BUILD=docker TARGET_REPOSITORY=voltha/ make push
+              tag="${params.manifestBranch}"
+            fi
+
+            if [ "${params.releaseTag}" != "" ]
+            then
+              VOLTHA_BUILD=docker TAG=${tag} TARGET_REPOSITORY=voltha/ TARGET_TAG=${params.releaseTag} make push
+            else
+              VOLTHA_BUILD=docker TAG=${tag} TARGET_REPOSITORY=voltha/ TARGET_TAG=${tag} make push
             fi
             popd
             """
diff --git a/jjb/voltha-publish.yaml b/jjb/voltha-publish.yaml
index e58a5ef..f76f14a 100644
--- a/jjb/voltha-publish.yaml
+++ b/jjb/voltha-publish.yaml
@@ -53,6 +53,11 @@
           description: 'Name of the repo branch to use'
 
       - string:
+          name: releaseTag
+          default: ''
+          description: 'Tag for the containers on Docker Hub'
+
+      - string:
           name: failureEmail
           default: '{failure-email-address}, $GERRIT_PATCHSET_UPLOADER_EMAIL'
           description: 'On job failure, send an email to these addresses'