Merge "Send email on publish-imagebuilder job failures"
diff --git a/jjb/pipeline/voltha-automated-build.groovy b/jjb/pipeline/voltha-automated-build.groovy
new file mode 100644
index 0000000..6b11292
--- /dev/null
+++ b/jjb/pipeline/voltha-automated-build.groovy
@@ -0,0 +1,68 @@
+/* voltha-automated-build pipeline */
+
+pipeline {
+
+  /* no label, executor is determined by JJB */
+  agent {
+    label "${params.executorNode}"
+  }
+
+  stages {
+
+    stage ('Cleanup workspace') {
+        steps {
+        sh 'rm -rf ./build ./component ./incubator ./onos-apps ./orchestration ./test ./.repo'
+        }
+    }
+
+    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 ('Bring up voltha dev vm') {
+      steps {
+        sh '''
+        pushd incubator/voltha
+        vagrant up voltha
+        popd
+        '''
+        }
+      }
+    stage ('Remove the pre-created venv-linux') {
+      steps {
+        sh 'vagrant ssh -c "rm -rf /cord/incubator/voltha/venv-linux"'
+        }
+      }
+
+    stage ('Build voltha') {
+      steps {
+        sh 'vagrant ssh -c "cd /cord/incubator/voltha && source env.sh && make fetch-jenkins && make jenkins" voltha' }
+        }
+
+    stage ('Bring up voltha containers') {
+      steps {
+        sh 'vagrant ssh -c "cd /cord/incubator/voltha && source env.sh && docker-compose -f compose/docker-compose-docutests.yml up -d" voltha' }
+        }
+
+    stage ('Run Integration Tests') {
+      steps {
+        sh 'vagrant ssh -c "cd /cord/incubator/voltha && source env.sh && make jenkins-test" voltha' }
+        }
+
+    }
+}
diff --git a/jjb/voltha-automated-build.yaml b/jjb/voltha-automated-build.yaml
new file mode 100644
index 0000000..6daa512
--- /dev/null
+++ b/jjb/voltha-automated-build.yaml
@@ -0,0 +1,53 @@
+---
+# Run build+test of voltha
+
+- project:
+    name: voltha-automated-build
+
+    project-name: '{name}'
+
+    jobs:
+      - 'voltha-build'
+
+- job-template:
+    id: voltha-build
+    name: 'voltha-automated-build'
+    description: |
+      Created by {id} job-template from ci-management/jjb/voltha-automated-build.yaml
+
+    triggers:
+       - timed: |
+                 TZ=America/Los_Angeles
+                 H 2 * * *
+
+    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: '60'
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+    parameters:
+      - string:
+         name: executorNode
+         default: 'onf-build'
+         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'
+
+    project-type: pipeline
+    concurrent: true
+
+    dsl: !include-raw-escape: pipeline/voltha-automated-build.groovy
+