Add packer build and validate job to build images 74/45474/4
authorAnil Belur <abelur@linuxfoundation.org>
Sun, 11 Sep 2016 07:46:22 +0000 (17:46 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Wed, 14 Sep 2016 02:15:04 +0000 (12:15 +1000)
Change-Id: I9afaa4ebbe0914d804250deaabf1108fd74fab58
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
jjb/releng-jobs.yaml
jjb/releng-macros.yaml
packer/provision/java-builder.sh

index d385251772271ed8fd1b7811ea8505bb4cfeb6fb..3bc20228a49f3b5927ba89e40f3d2460aa12fcac 100644 (file)
@@ -6,8 +6,39 @@
         - 'builder-merge'
         - 'builder-weekly'
         - 'builder-check-poms'
+        - 'builder-verify-packer-{platforms}-{templates}'
+        - 'builder-merge-packer-{platforms}-{templates}'
+
+    platforms:
+        - centos
+        - ubuntu-14.04
+
+    templates:
+        - devstack
+        - docker
+        - gbp
+        - java-builder
+        - mininet
+        - mininet-ovs-2.3
+        - mininet-ovs-2.5
+        - robot
+
+    exclude:
+        - platforms: centos
+          templates: gbp
+        - platforms: centos
+          templates: mininet
+        - platforms: centos
+          templates: mininet-ovs-2.3
+        - platforms: centos
+          templates: mininet-ovs-2.5
+        - platforms: ubuntu-14.04
+          templates: java-builder
 
+    project-type: freestyle
+    archive-artifacts: '**/*.log'
     project: 'releng/builder'
+    build-timeout: '60'
 
 - job-template:
     name: builder-verify-jjb
             email-prefix: '[releng]'
         - opendaylight-infra-shiplogs:
             maven-version: '{mvn33}'
+
+- job-template:
+    name: 'builder-verify-packer-{platforms}-{templates}'
+    project-type: freestyle
+    node: centos7-java-builder-2c-8g
+    concurrent: true
+
+    logrotate:
+        daysToKeep: 14
+
+    parameters:
+        - opendaylight-infra-parameters:
+            project: '{project}'
+            branch: '{branch}'
+            refspec: 'refs/heads/{branch}'
+            artifacts: '{archive-artifacts}'
+
+    scm:
+        - gerrit-trigger-scm:
+            refspec: '$GERRIT_REFSPEC'
+            choosing-strategy: 'gerrit'
+
+    wrappers:
+        - opendaylight-infra-wrappers:
+            build-timeout: '{build-timeout}'
+
+    triggers:
+        - gerrit:
+            server-name: 'OpenDaylight'
+            trigger-on:
+                - patchset-created-event:
+                    exclude-drafts: 'true'
+                    exclude-trivial-rebase: 'false'
+                    exclude-no-code-change: 'true'
+                - draft-published-event
+                - comment-added-contains-event:
+                    comment-contains-value: 'recheck'
+                - comment-added-contains-event:
+                    comment-contains-value: 'reverify'
+            projects:
+              - project-compare-type: 'ANT'
+                project-pattern: '{project}'
+                branches:
+                  - branch-compare-type: 'ANT'
+                    branch-pattern: '**/{branch}'
+                file-paths:
+                    - compare-type: ANT
+                      pattern: 'packer/**'
+
+    builders:
+        - packer-validate:
+            platform: '{platforms}'
+            template: '{templates}'
+
+    publishers:
+        - email-notification:
+            email-prefix: '[{project}]'
+        - opendaylight-infra-shiplogs:
+            maven-version: '{mvn33}'
+
+- job-template:
+    name: 'builder-merge-packer-{platforms}-{templates}'
+    project-type: freestyle
+    node: centos7-java-builder-2c-8g
+    concurrent: true
+
+    logrotate:
+        daysToKeep: 14
+
+    parameters:
+        - opendaylight-infra-parameters:
+            project: '{project}'
+            branch: '{branch}'
+            refspec: 'refs/heads/{branch}'
+            artifacts: '{archive-artifacts}'
+
+    scm:
+        - gerrit-trigger-scm:
+            refspec: '$GERRIT_REFSPEC'
+            choosing-strategy: 'gerrit'
+
+    wrappers:
+        - opendaylight-infra-wrappers:
+            build-timeout: '{build-timeout}'
+
+    triggers:
+        - gerrit:
+            server-name: 'OpenDaylight'
+            trigger-on:
+                - patchset-created-event:
+                    exclude-drafts: 'true'
+                    exclude-trivial-rebase: 'false'
+                    exclude-no-code-change: 'true'
+                - draft-published-event
+                - comment-added-contains-event:
+                    comment-contains-value: 'recheck'
+                - comment-added-contains-event:
+                    comment-contains-value: 'reverify'
+            projects:
+              - project-compare-type: 'ANT'
+                project-pattern: '{project}'
+                branches:
+                  - branch-compare-type: 'ANT'
+                    branch-pattern: '**/{branch}'
+                file-paths:
+                    - compare-type: ANT
+                      pattern: 'packer/**'
+
+    builders:
+        - packer-validate:
+            platform: '{platforms}'
+            template: '{templates}'
+        - packer-build:
+            platform: '{platforms}'
+            template: '{templates}'
+
+    publishers:
+        - email-notification:
+            email-prefix: '[{project}]'
+        - opendaylight-infra-shiplogs:
+            maven-version: '{mvn33}'
index 820abd08440e79a8a00951e98fac869c4e35ffb8..c6961aee37b78810c9f2a3618f83952473970fe3 100644 (file)
             single-use: True
         - openstack:
             single-use: True
+
+- builder:
+    name: packer-validate
+    builders:
+        - config-file-provider:
+            files:
+                - file-id: 'packer-cloud-env'
+                  variable: 'CLOUDENV'
+        - shell: |
+            cd packer
+            export PACKER_LOG="yes" && \
+            export PACKER_LOG_PATH="packer-validate.log" && \
+                        packer.io validate -var-file=$CLOUDENV \
+                         -var-file=../packer/vars/{platform}.json \
+                         ../packer/templates/{template}.json
+
+- builder:
+    name: packer-build
+    builders:
+        - shell: |
+            cd packer
+            export PACKER_LOG="yes" && \
+            export PACKER_LOG_PATH="packer-build.log" && \
+                        packer.io build -var-file=$CLOUDENV \
+                         -var-file=../packer/vars/{platform}.json \
+                         ../packer/templates/{template}.json
index f4829c69245af758f56baabed4a6c45006dce9e9..bf239ff27c6bb2f8bea452bb22396b95681ff54c 100644 (file)
@@ -38,3 +38,12 @@ yum-config-manager -q -y --add-repo http://download.mono-project.com/repo/centos
 #install the mono toolchain and nuget
 yum -q -y install mono-complete-4.2.3.4 nuget
 #end changes for vsemprovider in VTN
+
+# The following installs hashicorp's packer binary which is required  for
+# the {verify,merge}-packer jobs
+mkdir /tmp/packer
+cd /tmp/packer
+wget https://releases.hashicorp.com/packer/0.10.1/packer_0.10.1_linux_amd64.zip
+unzip packer_0.10.1_linux_amd64.zip -d /usr/local/bin/
+# rename packer to avoid conflict with binary in cracklib
+mv /usr/local/bin/packer /usr/local/bin/packer.io