summaryrefslogtreecommitdiffstats
path: root/jjb/global-macros.yaml
diff options
context:
space:
mode:
authorAnil Belur <abelur@linuxfoundation.org>2017-02-15 13:19:52 +1000
committerAnil Belur <abelur@linuxfoundation.org>2017-02-16 13:10:03 +1000
commitc8a35f918e87a609dea15b749a71a960e50a8497 (patch)
tree76c92f5d12894572f717e274d151cc5a3c9048f5 /jjb/global-macros.yaml
parent4f9ec4dba102cd5ba21f7982ac08445a2912f5a9 (diff)
Add packer verify and merge jobs
- These jobs have been ported from ODL releng - Jobs are designed to build new images first of every month - Verify runs a packer validation on the templates and verifies the syntax of provision scripts - Merge job is designed to trigger a build only relevent to the change rather than building all images Change-Id: I882fdf9d60a49221e1d9f50809c5fda1d8ebf4fb Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
Diffstat (limited to 'jjb/global-macros.yaml')
-rw-r--r--jjb/global-macros.yaml57
1 files changed, 57 insertions, 0 deletions
diff --git a/jjb/global-macros.yaml b/jjb/global-macros.yaml
index 2493c2b52..cdecdce39 100644
--- a/jjb/global-macros.yaml
+++ b/jjb/global-macros.yaml
@@ -337,3 +337,60 @@
variable: 'GLOBAL_SETTINGS_FILE'
- file-id: '{settings-file}'
variable: 'SETTINGS_FILE'
+
+- property:
+ name: fdio-infra-properties
+ properties:
+ - build-discarder:
+ days-to-keep: '{build-days-to-keep}'
+ num-to-keep: '{build-num-to-keep}'
+
+
+- builder:
+ name: packer-validate
+ builders:
+ - config-file-provider:
+ files:
+ - file-id: 'packer-cloud-env'
+ variable: 'CLOUDENV'
+ - shell: |
+ #!/bin/bash
+ cd packer
+ varfiles="../packer/vars/*"
+ templates="../packer/templates/*"
+ provision="../packer/provision/*.sh"
+ for v in $varfiles; do
+ [[ "${v##*/}" =~ ^(cloud-env.*)$ ]] && continue
+ for t in $templates; do
+ export PACKER_LOG="yes" && \
+ export PACKER_LOG_PATH="packer-validate-${v##*/}-${t##*/}.log" && \
+ packer.io validate -var-file=$CLOUDENV \
+ -var-file=$v $t
+ if [ $? -ne 0 ]; then
+ break
+ fi
+ done
+ done
+ for p in $provision; do
+ /bin/bash -n $p > provision-validate-${p##*/}.log 2>&1
+ if [ $? -ne 0 ]; then
+ break
+ fi
+ done
+
+
+- builder:
+ name: packer-build
+ builders:
+ - config-file-provider:
+ files:
+ - file-id: 'packer-cloud-env'
+ variable: 'CLOUDENV'
+ - shell: |
+ #!/bin/bash
+ 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