From c8a35f918e87a609dea15b749a71a960e50a8497 Mon Sep 17 00:00:00 2001 From: Anil Belur Date: Wed, 15 Feb 2017 13:19:52 +1000 Subject: 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 --- jjb/global-macros.yaml | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'jjb/global-macros.yaml') 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 -- cgit 1.2.3-korg