Add refspec to docker-publish job

Change-Id: Ie6cff3d4e5b042416582337e9216a2eb4e8d0c9b
diff --git a/jjb/pipeline/docker-publish.groovy b/jjb/pipeline/docker-publish.groovy
index 9738c62..d0c0e13 100644
--- a/jjb/pipeline/docker-publish.groovy
+++ b/jjb/pipeline/docker-publish.groovy
@@ -25,7 +25,7 @@
       steps {
         checkout([
           $class: 'GitSCM',
-          userRemoteConfigs: [[ url: "${params.gitUrl}", credentialsId: 'onos-jenkins-ssh']],
+          userRemoteConfigs: [[ url: "${params.gitUrl}", credentialsId: 'onos-jenkins-ssh', refspec: "${params.gitRefSpec}"]],
           branches: [[ name: "${params.gitRef}", ]],
           extensions: [
             [$class: 'WipeWorkspace'],
diff --git a/jjb/templates/docker-publish.yaml b/jjb/templates/docker-publish.yaml
index 1f67833..6d143f9 100644
--- a/jjb/templates/docker-publish.yaml
+++ b/jjb/templates/docker-publish.yaml
@@ -42,6 +42,11 @@
           description: 'git ref to build (commit hash or tag)'
 
       - string:
+          name: gitRefSpec
+          default: '$GERRIT_REFSPEC'
+          description: 'git refSpec to build (refs/changes/)'
+
+      - string:
           name: projectName
           default: '$GERRIT_PROJECT'
           description: 'Name of the project in Gerrit'
diff --git a/jjb/templates/private-docker-publish.yaml b/jjb/templates/private-docker-publish.yaml
index edbba0d..54daf07 100644
--- a/jjb/templates/private-docker-publish.yaml
+++ b/jjb/templates/private-docker-publish.yaml
@@ -66,6 +66,11 @@
           description: 'git ref to build (commit hash or tag)'
 
       - string:
+          name: gitRefSpec
+          default: '$GERRIT_REFSPEC'
+          description: 'git refSpec to build (refs/changes/)'
+
+      - string:
           name: projectName
           default: '$GERRIT_PROJECT'
           description: 'Name of the project in Gerrit'