Added vagrant setup for a Jenkins system for ONAP

Add a set of vagrant scripts that will set up a
local Jenkins environment with pre-defined jobs
to build all the ONAP java code and docker images.

Change-Id: I67ed254bcb38a7be989b7c2861fd3ea4ec9c66f2
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
diff --git a/bootstrap/jenkins/vagrant/jjb/docker-jobs.yaml b/bootstrap/jenkins/vagrant/jjb/docker-jobs.yaml
new file mode 100644
index 0000000..5925b5d
--- /dev/null
+++ b/bootstrap/jenkins/vagrant/jjb/docker-jobs.yaml
@@ -0,0 +1,76 @@
+- project:
+    name: onap-docker-with-pom
+    jobs:
+     - 'docker-with-pom'
+    project:
+     - 'aai_aai-service_ajsc-aai':
+         repo: 'aai/aai-service'
+         pom: 'ajsc-aai/pom.xml'
+         mvn-options: 'docker:build'
+     - 'aai_data-router':
+         repo: 'aai/data-router'
+         pom: 'pom.xml'
+         mvn-options: 'docker:build'
+     - 'aai_model-loader':
+         repo: 'aai/model-loader'
+         pom: 'pom.xml'
+         mvn-options: 'docker:build'
+     - 'aai_resources_aai-resources':
+         repo: 'aai/resources'
+         pom: 'aai-resources/pom.xml'
+         mvn-options: 'docker:build'
+     - 'aai_search-data-service':
+         repo: 'aai/search-data-service'
+         mvn-options: 'docker:build'
+     - 'aai_sparky-be':
+         repo: 'aai/sparky-be'
+         mvn-options: 'docker:build'
+     - 'aai_traversal_aai-traversal':
+         repo: 'aai/traversal'
+         pom: 'aai-traversal/pom.xml'
+         mvn-options: 'docker:build'
+     - 'appc':
+         repo: 'appc/deployment'
+         mvn-options: '-P docker'
+     - 'dcae_dcae-controller':
+         repo: 'dcae/demo'
+         shell-cmd: 'bash dcae-demo-controller/src/main/docker-build/build.sh'
+     - 'dcae_dcae-dmaapbc':
+         repo: 'dcae/dmaapbc'
+         shell-cmd: 'docker build -f ./Dockerfile .'
+     - 'dcae_dcae-inventory':
+         repo: 'dcae/dcae-inventory'
+         mvn-options: 'docker:build'
+     - 'mso':
+         repo: 'mso'
+         pom: 'packages/docker/pom.xml'
+         mvn-options: '-P docker'
+     - 'policy':
+         repo: 'policy/docker'
+         shell-cmd: './docker_build.sh'
+     - 'portal_ecomp-portal-widget-ms':
+         repo: 'portal'
+         pom: 'ecomp-portal-widget-ms/pom.xml'
+         mvn-options: 'docker:build'
+     - 'sdc':
+         repo: 'sdc'
+         pom: 'pom.xml'
+         mvn-options: '-P docker'
+     - 'sdnc':
+         repo: 'sdnc/oam'
+         mvn-options: '-P docker'
+     - 'vid':
+         repo: 'vid'
+         mvn-options: '-P docker'
+
+- project:
+    name: onap-docker-without-pom
+    jobs:
+     - 'docker-without-pom'
+    project:
+     - 'dcae_dcae-orch-dispatcher':
+         repo: 'dcae/orch-dispatcher'
+         shell-cmd: 'docker build -f ./Dockerfile .'
+     - 'portal':
+         repo: 'portal'
+         shell-cmd: 'git -C ecompsdkos pull || git clone $GIT_NO_PROJECT/ecompsdkos; git -C dmaapbc pull || git clone $GIT_NO_PROJECT/ui/dmaapbc dmaapbc; cd deliveries; chmod +x *.sh; ./run.sh'
diff --git a/bootstrap/jenkins/vagrant/jjb/include-docker-login.sh b/bootstrap/jenkins/vagrant/jjb/include-docker-login.sh
new file mode 100644
index 0000000..561a91f
--- /dev/null
+++ b/bootstrap/jenkins/vagrant/jjb/include-docker-login.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+# vim: ts=4 sw=4 sts=4 et :
+
+DOCKER_REPOSITORIES="nexus3.onap.org:10001 \
+                   nexus3.onap.org:10002 \
+                   nexus3.onap.org:10003 \
+                   nexus3.onap.org:10004"
+
+for DOCKER_REPOSITORY in $DOCKER_REPOSITORIES;
+do
+    echo $DOCKER_REPOSITORY
+    docker login $DOCKER_REPOSITORY -u "anonymous" -p "anonymous"
+done
diff --git a/bootstrap/jenkins/vagrant/jjb/java-jobs.yaml b/bootstrap/jenkins/vagrant/jjb/java-jobs.yaml
new file mode 100644
index 0000000..570802e
--- /dev/null
+++ b/bootstrap/jenkins/vagrant/jjb/java-jobs.yaml
@@ -0,0 +1,167 @@
+- project:
+    name: onap-java
+    jobs:
+     - 'java-{project}'
+    project:
+     - 'aai_aai-common':
+         repo: 'aai/aai-common'
+         pom: 'pom.xml'
+     - 'aai_aai-service':
+         repo: 'aai/aai-service'
+         pom: 'pom.xml'
+     - 'aai_data-router':
+         repo: 'aai/data-router'
+         pom: 'pom.xml'
+     - 'aai_logging-service':
+         repo: 'aai/logging-service'
+         pom: 'pom.xml'
+     - 'aai_model-loader':
+         repo: 'aai/model-loader'
+         pom: 'pom.xml'
+     - 'aai_resources':
+         repo: 'aai/resources'
+         pom: 'pom.xml'
+     - 'aai_rest-client':
+         repo: 'aai/rest-client'
+         pom: 'pom.xml'
+     - 'aai_router-core':
+         repo: 'aai/router-core'
+         pom: 'pom.xml'
+     - 'aai_search-data-service':
+         repo: 'aai/search-data-service'
+         pom: 'pom.xml'
+     - 'aai_sparky-fe':
+         repo: 'aai/sparky-fe'
+         pom: 'pom.xml'
+     - 'aai_traversal':
+         repo: 'aai/traversal'
+         pom: 'pom.xml'
+     - 'appc':
+         repo: 'appc'
+         pom: 'pom.xml'
+     - 'appc_deployment':
+         repo: 'appc/deployment'
+         pom: 'pom.xml'
+     - 'dcae_apod_analytics':
+         repo: 'dcae/apod/analytics'
+         pom: 'pom.xml'
+     - 'dcae_collectors_ves':
+         repo: 'dcae/collectors/ves'
+         pom: 'pom.xml'
+     - 'dcae_controller':
+         repo: 'dcae/controller'
+         pom: 'pom.xml'
+     - 'dcae_controller_analytics':
+         repo: 'dcae/controller/analytics'
+         pom: 'pom.xml'
+     - 'dcae_dcae-inventory':
+         repo: 'dcae/dcae-inventory'
+         pom: 'pom.xml'
+     - 'dcae_demo':
+         repo: 'dcae/demo'
+         pom: 'pom.xml'
+     - 'dcae_dmaapbc':
+         repo: 'dcae/dmaapbc'
+         pom: 'pom.xml'
+     - 'dcae_operation_utils':
+         repo: 'dcae/operation/utils'
+         pom: 'pom.xml'
+     - 'dcae_pgaas_cdf_src_cdf-prop-value_cdf-prop-value':
+         repo: 'dcae/pgaas'
+         pom: 'cdf/src/cdf-prop-value/cdf-prop-value/pom.xml'
+     - 'dcae_pgaas_cdf_src_cdf-prop-value_cdf-util':
+         repo: 'dcae/pgaas'
+         pom: 'cdf/src/cdf-prop-value/cdf-util/pom.xml'
+     - 'demo':
+         repo: 'demo'
+         pom: 'pom.xml'
+     - 'ecompsdkos_ecomp-sdk':
+         repo: 'ecompsdkos'
+         pom: 'ecomp-sdk/pom.xml'
+     - 'mso':
+         repo: 'mso'
+         pom: 'pom.xml'
+     - 'mso_libs':
+         repo: 'mso/libs'
+         pom: 'pom.xml'
+     - 'ncomp_cdap':
+         repo: 'ncomp/cdap'
+         pom: 'pom.xml'
+     - 'ncomp_core':
+         repo: 'ncomp/core'
+         pom: 'pom.xml'
+     - 'ncomp_docker':
+         repo: 'ncomp/docker'
+         pom: 'pom.xml'
+     - 'ncomp_maven':
+         repo: 'ncomp/maven'
+         pom: 'pom.xml'
+     - 'ncomp_openstack':
+         repo: 'ncomp/openstack'
+         pom: 'pom.xml'
+     - 'ncomp_sirius_manager':
+         repo: 'ncomp/sirius/manager'
+         pom: 'pom.xml'
+     - 'ncomp_utils':
+         repo: 'ncomp/utils'
+         pom: 'pom.xml'
+     - 'policy_common':
+         repo: 'policy/common'
+         pom: 'pom.xml'
+     - 'policy_docker':
+         repo: 'policy/docker'
+         pom: 'pom.xml'
+     - 'policy_drools-applications':
+         repo: 'policy/drools-applications'
+         pom: 'pom.xml'
+     - 'policy_drools-pdp':
+         repo: 'policy/drools-pdp'
+         pom: 'pom.xml'
+     - 'policy_engine':
+         repo: 'policy/engine'
+         pom: 'pom.xml'
+     - 'portal':
+         repo: 'portal'
+         pom: 'pom.xml'
+     - 'sdc':
+         repo: 'sdc'
+         pom: 'pom.xml'
+     - 'sdc_jtosca':
+         repo: 'sdc/jtosca'
+         pom: 'pom.xml'
+     - 'sdc_sdc-distribution-client':
+         repo: 'sdc/sdc-distribution-client'
+         pom: 'pom.xml'
+     - 'sdc_sdc-titan-cassandra':
+         repo: 'sdc/sdc-titan-cassandra'
+         pom: 'pom.xml'
+     - 'sdc_sdc-tosca':
+         repo: 'sdc/sdc-tosca'
+         pom: 'pom.xml'
+     - 'sdc_sdc_common':
+         repo: 'sdc/sdc_common'
+         pom: 'pom.xml'
+     - 'sdnc_adaptors':
+         repo: 'sdnc/adaptors'
+         pom: 'pom.xml'
+     - 'sdnc_core':
+         repo: 'sdnc/core'
+         pom: 'pom.xml'
+     - 'sdnc_northbound':
+         repo: 'sdnc/northbound'
+         pom: 'pom.xml'
+     - 'sdnc_oam':
+         repo: 'sdnc/oam'
+         pom: 'pom.xml'
+     - 'sdnc_plugins':
+         repo: 'sdnc/plugins'
+         pom: 'pom.xml'
+     - 'ui_dmaapbc':
+         repo: 'ui/dmaapbc'
+         pom: 'pom.xml'
+     - 'vid':
+         repo: 'vid'
+         pom: 'pom.xml'
+     - 'vid_asdcclient':
+         repo: 'vid/asdcclient'
+         pom: 'pom.xml'
diff --git a/bootstrap/jenkins/vagrant/jjb/template.yaml b/bootstrap/jenkins/vagrant/jjb/template.yaml
new file mode 100644
index 0000000..e035583
--- /dev/null
+++ b/bootstrap/jenkins/vagrant/jjb/template.yaml
@@ -0,0 +1,76 @@
+- builder:
+    name: docker-login
+    builders:
+      - shell: !include-raw: include-docker-login.sh
+
+- job-template:
+    name: 'java-{project}'
+    project-type: freestyle
+    scm:
+      - git:
+          url: 'http://gerrit.onap.org/r/{repo}'
+          branches:
+            - '*/master'
+          wipe-workspace: false
+          skip-tag: true
+          timeout: 30
+    builders:
+      - maven-target:
+          goals: '-B clean install'
+          pom: '{pom}'
+          properties:
+            - skipTests=true
+
+- job-template:
+    id: docker-with-pom
+    name: 'docker-{project}'
+    project-type: freestyle
+    pom: 'pom.xml'
+    mvn-options: ''
+    shell-cmd: ''
+    scm:
+      - git:
+          url: 'http://gerrit.onap.org/r/{repo}'
+          branches:
+            - '*/master'
+          wipe-workspace: false
+          skip-tag: true
+          timeout: 30
+    properties:
+      - inject:
+          properties-content: |
+            GIT_NO_PROJECT=http://gerrit.onap.org/r
+    builders:
+      - docker-login
+      - maven-target:
+          goals: '-B clean package {mvn-options}'
+          pom: '{pom}'
+          properties:
+            - skipTests=true
+            - docker.pull.registry=nexus3.onap.org:10001
+            - docker.push.registry=nexus3.onap.org:10003
+      - shell: "{shell-cmd}"
+
+- job-template:
+    id: docker-without-pom
+    name: 'docker-{project}'
+    project-type: freestyle
+    shell-cmd: ''
+    scm:
+      - git:
+          url: 'http://gerrit.onap.org/r/{repo}'
+          branches:
+            - '*/master'
+          wipe-workspace: false
+          skip-tag: true
+          timeout: 30
+    properties:
+      - inject:
+          properties-content: |
+            GIT_NO_PROJECT=http://gerrit.onap.org/r
+            GLOBAL_SETTINGS_FILE=/var/lib/jenkins/.m2/settings.xml
+            SETTINGS_FILE=/var/lib/jenkins/.m2/settings.xml
+            MVN=mvn
+    builders:
+      - docker-login
+      - shell: "{shell-cmd}"