Add job to generate an image list for docs 67/50767/10
authorThanh Ha <thanh.ha@linuxfoundation.org>
Sat, 21 Jan 2017 19:22:17 +0000 (14:22 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Mon, 6 Feb 2017 20:10:58 +0000 (15:10 -0500)
With Heat now available we need a way to automate the list of available
images projects can use in their jobs in the docs. This creates a job
that will pull from openstack a list of available public images and
pushes a patch automatically to Gerrit to update the relevant
documentation page. The script will automatically detect if an unmerged
image update patch already exists and update existing patch if available
otherwise create a new one.

Change-Id: If5ea2c53b21b06ab1ed5d6c9c17f30356a930dc4
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
jjb/opendaylight-infra-update-image-list.sh [new file with mode: 0644]
jjb/releng-jobs.yaml

diff --git a/jjb/opendaylight-infra-update-image-list.sh b/jjb/opendaylight-infra-update-image-list.sh
new file mode 100644 (file)
index 0000000..7c7e3c9
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+virtualenv $WORKSPACE/.venv
+source $WORKSPACE/.venv/bin/activate
+pip install --upgrade --quiet pip
+pip install --upgrade --quiet python-openstackclient python-heatclient
+pip freeze
+
+cat > $WORKSPACE/docs/cloud-images.rst << EOF
+Following are the list of published images available to be used with Jenkins jobs.
+
+EOF
+# Blank line before EOF is on purpose to ensure there is spacing.
+
+IFS=$'\n'
+IMAGES=(`openstack --os-cloud odlpriv image list --public -f value -c Name`)
+for i in ${IMAGES[@]}; do
+    echo "* $i" >> $WORKSPACE/docs/cloud-images.rst
+done
+
+git add docs/cloud-images.rst
index aad8b08f52b12dcbbe12ba22b7c51b3ddffa88a5..bc556cf82a015bfe0c4d2c90f0e1264063caa328 100644 (file)
@@ -8,8 +8,11 @@
         - 'builder-check-poms'
         - 'builder-verify-packer'
         - 'builder-merge-packer-{platforms}-{templates}'
+        # OpenStack Related
         - 'builder-delete-stale-stacks'
+        # Automation for docs and jobs
         - 'builder-update-csit-tests'
+        - 'builder-update-image-list'
 
     platforms:
         - centos
         - opendaylight-infra-shiplogs:
             maven-version: 'mvn33'
 
+- job-template:
+    name: 'builder-update-image-list'
+    project-type: freestyle
+    node: centos7-java-builder-2c-4g
+
+    properties:
+        - opendaylight-infra-properties:
+            build-days-to-keep: 7
+
+    parameters:
+        - opendaylight-infra-parameters:
+            project: '{project}'
+            branch: '{branch}'
+            refspec: 'refs/heads/{branch}'
+            artifacts: '{archive-artifacts}'
+
+    scm:
+        - git-scm:
+            branch: '{branch}'
+
+    wrappers:
+        - opendaylight-infra-wrappers:
+            build-timeout: '{build-timeout}'
+        # Listed after to override openstack-infra-wrappers clouds.yaml definition
+        - config-file-provider:
+            files:
+                - file-id: opendaylight-private-clouds-yaml
+                  target: '$HOME/.config/openstack/clouds.yaml'
+
+    triggers:
+        # Update image list every Monday to Friday at 11:00 UTC
+        - timed: '0 11 * * 1-5'
+
+    builders:
+        - shell: !include-raw-escape: opendaylight-infra-update-image-list.sh
+        - opendaylight-infra-push-gerrit-patch:
+            project: '{project}'
+            gerrit-topic: 'releng-update-cloud-image-list'
+            gerrit-commit-message: 'Update cloud image list docs'
+
+    publishers:
+        - email-notification:
+            email-recipients: '{email-recipients}'
+            email-prefix: '[releng]'
+        - opendaylight-infra-shiplogs:
+            maven-version: 'mvn33'
+
 - job-template:
     name: 'builder-verify-packer'
     project-type: freestyle