diff options
author | Anil Belur <abelur@linuxfoundation.org> | 2017-05-24 19:20:50 +1000 |
---|---|---|
committer | Anil Belur <abelur@linuxfoundation.org> | 2017-06-16 10:00:34 +1000 |
commit | a32358763fecf10bda78806374aba34b51befcf9 (patch) | |
tree | 3cb9548a3f6991cf79ddc89c9af0aa9b9c29b2ff /jjb | |
parent | a071b7895b5eaf1967a26a43c0d61746576edbf1 (diff) |
Add packer verify and merge jobs for AGL
Packer jobs are designed to rebuild new minon images regularly. These
jobs are also triggered on changes submitted to the templates or
provision scripts.
New images generated by packer must be manually updated on Jenkins.
Change-Id: Ie2e7dbcbc57148693ad1cf4179ceda2f7a3c9d1a
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
Diffstat (limited to 'jjb')
-rw-r--r-- | jjb/ci-management/ci-management.yaml | 132 | ||||
-rw-r--r-- | jjb/global-defaults.yaml | 3 | ||||
-rw-r--r-- | jjb/global-macros.yaml | 55 |
3 files changed, 189 insertions, 1 deletions
diff --git a/jjb/ci-management/ci-management.yaml b/jjb/ci-management/ci-management.yaml index a519b75f..07811ea5 100644 --- a/jjb/ci-management/ci-management.yaml +++ b/jjb/ci-management/ci-management.yaml @@ -4,10 +4,20 @@ jobs: - 'ci-management-verify-jjb' - 'ci-management-merge' + - 'ci-management-verify-packer' + - 'ci-management-merge-packer-{platforms}-{templates}' project: 'ci-management' branch: master + platforms: + - ubuntu-16.04 + + templates: + - basebuild-agl-test-slave + - basebuild-control-slave + - basebuild + - job-template: name: ci-management-verify-jjb @@ -35,6 +45,7 @@ - gerrit-trigger-patch-submitted: name: '{project}' branch: '{branch}' + files: '**/**' builders: - shell: | @@ -65,7 +76,7 @@ choosing-strategy: 'default' wrappers: - - agl-infra-wrappers: + - agl-infra-wrappers: build-timeout: '{build-timeout}' triggers: @@ -76,3 +87,122 @@ builders: - shell: !include-raw-escape: include-raw-jjb-update.sh + + +- job-template: + name: 'ci-management-verify-packer' + project-type: freestyle + node: control-slave + concurrent: true + + properties: + - agl-infra-properties: + build-days-to-keep: '{build-days-to-keep}' + build-num-to-keep: '{build-num-to-keep}' + + + parameters: + - agl-infra-parameters: + project: '{project}' + branch: 'master' + refspec: 'refs/heads/master' + + scm: + - gerrit-trigger-scm: + refspec: '$GERRIT_REFSPEC' + choosing-strategy: 'gerrit' + + wrappers: + - agl-infra-wrappers: + build-timeout: '{build-timeout}' + + triggers: + - gerrit-trigger-patch-submitted: + name: 'AGL/AGL-repo' + branch: '{branch}' + files: 'packer/**' + + builders: + - packer-validate: + + publishers: + - archive: + artifacts: 'packer/*.log' + allow-empty: 'true' + only-if-success: 'true' + +- job-template: + name: 'ci-management-merge-packer-{platforms}-{templates}' + project-type: freestyle + node: control-slave + + properties: + - agl-infra-properties: + build-days-to-keep: '{build-days-to-keep}' + build-num-to-keep: '{build-num-to-keep}' + + parameters: + - agl-infra-parameters: + project: '{project}' + branch: 'master' + refspec: 'refs/heads/master' + + scm: + - gerrit-trigger-scm: + refspec: '$GERRIT_REFSPEC' + choosing-strategy: 'gerrit' + + wrappers: + - ssh-agent-credentials: + users: + - '{ssh-credentials}' + - agl-infra-wrappers: + build-timeout: '{build-timeout}' + + triggers: + - timed: '00 10 1 * *' + - gerrit: + trigger-on: + - change-merged-event + - comment-added-contains-event: + comment-contains-value: 'remerge' + projects: + - project-compare-type: 'ANT' + project-pattern: 'ci-management' + branches: + - branch-compare-type: 'ANT' + branch-pattern: '**/{branch}' + file-paths: + - compare-type: ANT + pattern: 'packer/vars/{platforms}.json' + - compare-type: ANT + pattern: 'packer/templates/{templates}.json' + - compare-type: ANT + pattern: 'packer/provision/{templates}.sh' + - compare-type: ANT + pattern: 'packer/provision/system_reseal.sh' + - compare-type: ANT + pattern: 'packer/provision/rh-user_data.sh' + - compare-type: ANT + pattern: 'packer/provision/baseline.sh' + - compare-type: ANT + pattern: 'packer/provision/null_data.sh' + - compare-type: ANT + pattern: 'packer/provision/agl_dependencies.sh' + - compare-type: ANT + pattern: 'packer/provision/agl_mirror.sh' + - compare-type: ANT + pattern: 'packer/provision/basebuild-no-tmpfs.sh' + + + builders: + - packer-validate: + - packer-build: + platform: '{platforms}' + template: '{templates}' + + publishers: + - archive: + artifacts: 'packer/*.log' + allow-empty: 'true' + only-if-success: 'true' diff --git a/jjb/global-defaults.yaml b/jjb/global-defaults.yaml index 4e25be0f..e019b2ff 100644 --- a/jjb/global-defaults.yaml +++ b/jjb/global-defaults.yaml @@ -11,3 +11,6 @@ # Timeout in minutes build-timeout: 420 ssh-credentials: 'agl-jobbuilder' + + # AGL branch defaults + branch: master diff --git a/jjb/global-macros.yaml b/jjb/global-macros.yaml index b84eedf6..c73bd861 100644 --- a/jjb/global-macros.yaml +++ b/jjb/global-macros.yaml @@ -104,6 +104,9 @@ branches: - branch-compare-type: 'ANT' branch-pattern: '**/{branch}' + file-paths: + - compare-type: ANT + pattern: '{files}' - trigger: name: gerrit-trigger-patch-submitted-manual-verified-silent @@ -431,3 +434,55 @@ - ansicolor - openstack: single-use: false + +- property: + name: agl-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 -x + cd packer + varfiles="../packer/vars/*" + templates="../packer/templates/*" + provision="../packer/provision/*.sh" + for v in $varfiles; do + [[ "${v##*/}" =~ ^(cloud-env.*|README.*)$ ]] && 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 + done + +- builder: + name: packer-build + builders: + - config-file-provider: + files: + - file-id: 'packer-cloud-env' + variable: 'CLOUDENV' + - shell: | + cd packer + export PACKER_LOG="yes" && \ + export PACKER_LOG_PATH="packer-build.log" && \ + packer.io build -color=false -var-file=$CLOUDENV \ + -var-file=../packer/vars/{platform}.json \ + -parallel=false \ + ../packer/templates/{template}.json |