VOLTHA image publisher job

Change-Id: I175c058300d6ea03c56d86cd5d325214904bd936
diff --git a/jjb/imagebuilder.yaml b/jjb/imagebuilder.yaml
index 1f2a67b..10eac84 100644
--- a/jjb/imagebuilder.yaml
+++ b/jjb/imagebuilder.yaml
@@ -15,7 +15,7 @@
     id: publish-imagebuilder
     name: 'publish-imagebuilder'
     description: |
-      Created by {id} job-template from ci-management/jjb/helm.yaml
+      Created by {id} job-template from ci-management/jjb/imagebuilder.yaml
 
     triggers:
       - cord-infra-gerrit-trigger-merge:
@@ -51,8 +51,8 @@
           default: '$GERRIT_BRANCH'
           description: 'Name of the repo branch to use'
 
-# NOTE: May need to parameters that give the ability to rebuild from a specific
-# tag or commit on a branch.
+      # NOTE: May need to parameters that give the ability to rebuild from a specific
+      # tag or commit on a branch.
 
       - bool:
           name: build
@@ -65,9 +65,9 @@
           description: 'Force remove obsolete tags/images (same as "docker rmi --force")'
 
       - string:
-         name: failureEmail
-         default: '{failure-email-address}, $GERRIT_PATCHSET_UPLOADER_EMAIL'
-         description: 'On job failure, send an email to these addresses'
+          name: failureEmail
+          default: '{failure-email-address}, $GERRIT_PATCHSET_UPLOADER_EMAIL'
+          description: 'On job failure, send an email to these addresses'
 
     project-type: pipeline
     concurrent: false
diff --git a/jjb/pipeline/voltha-publish.groovy b/jjb/pipeline/voltha-publish.groovy
new file mode 100644
index 0000000..d56eca7
--- /dev/null
+++ b/jjb/pipeline/voltha-publish.groovy
@@ -0,0 +1,66 @@
+/* voltha-publish pipeline */
+pipeline {
+
+  /* no label, executor is determined by JJB */
+  agent {
+    label "${params.executorNode}"
+  }
+  stages {
+
+    stage('repo') {
+      steps {
+        checkout(changelog: false, \
+          poll: false,
+          scm: [$class: 'RepoScm', \
+            manifestRepositoryUrl: "${params.manifestUrl}", \
+            manifestBranch: "${params.manifestBranch}", \
+            currentBranch: true, \
+            destinationDir: 'cord', \
+            forceSync: true,
+            resetFirst: true, \
+            quiet: true, \
+            jobs: 4, \
+            showAllChanges: true] \
+          )
+      }
+    }
+
+    stage('build'){
+      steps {
+        sh """
+           #!/usr/bin/env bash
+
+           pushd cord/incubator/voltha
+           VOLTHA_BUILD=docker DOCKER_CACHE_ARG=--no-cache TAG=${params.manifestBranch} make build
+
+           popd
+           """
+      }
+    }
+
+    stage('push'){
+      steps {
+        withDockerRegistry([credentialsId: 'docker-artifact-push-credentials', url: '']) {
+          sh """
+            #!/usr/bin/env bash
+
+            pushd cord/incubator/voltha
+            VOLTHA_BUILD=docker TAG=${params.manifestBranch} TARGET_REPOSITORY=voltha/ TARGET_TAG=${params.manifestBranch} make push
+
+            popd
+            """
+        }
+      }
+    }
+  }
+
+  post {
+    failure {
+      emailext (
+        subject: "$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS",
+        body: "Check console output at $BUILD_URL to view the results.",
+        to: "${params.failureEmail}"
+      )
+    }
+  }
+}
diff --git a/jjb/voltha-publish.yaml b/jjb/voltha-publish.yaml
new file mode 100644
index 0000000..8ec5c41
--- /dev/null
+++ b/jjb/voltha-publish.yaml
@@ -0,0 +1,63 @@
+---
+# CORD docker image building + dockerhub publishing tasks
+
+- project:
+    name: voltha-publish
+
+    # add repos that have documentation to the project list in both jobs
+    jobs:
+      - 'voltha-publish':
+          project-regexp: 'voltha'
+          branch-regexp: 'voltha-1.6'
+          executor-node: 'imagebuilder'
+          dependency-jobs: ''
+
+- job-template:
+    id: voltha-publish
+    name: 'voltha-publish'
+    description: |
+      Created by {id} job-template from ci-management/jjb/voltha-publish.yaml
+
+    triggers:
+      - cord-infra-gerrit-trigger-merge:
+          gerrit-server-name: '{gerrit-server-name}'
+          project-regexp: '{project-regexp}'
+          branch-regexp: '{branch-regexp}'
+          file-include-regexp: '{all-files-regexp}'
+          dependency-jobs: '{dependency-jobs}'
+
+    properties:
+      - cord-infra-properties:
+          build-days-to-keep: '{build-days-to-keep}'
+          artifact-num-to-keep: '{artifact-num-to-keep}'
+
+    wrappers:
+      - lf-infra-wrappers:
+          build-timeout: '{build-timeout}'
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+    parameters:
+      - string:
+          name: executorNode
+          default: '{executor-node}'
+          description: 'Name of the Jenkins node to run the job on'
+
+      - string:
+          name: manifestUrl
+          default: '{gerrit-server-url}/{cord-repo-manifest}'
+          description: 'URL to the repo manifest'
+
+      - string:
+          name: manifestBranch
+          default: '$GERRIT_BRANCH'
+          description: 'Name of the repo branch to use'
+
+      - string:
+          name: failureEmail
+          default: '{failure-email-address}, $GERRIT_PATCHSET_UPLOADER_EMAIL'
+          description: 'On job failure, send an email to these addresses'
+
+    project-type: pipeline
+    concurrent: false
+
+    dsl: !include-raw-escape: pipeline/voltha-publish.groovy