Job for testing the ODL user configuration 16/73516/9
authorTaseer Ahmed <taseer94@gmail.com>
Thu, 28 Jun 2018 08:21:15 +0000 (13:21 +0500)
committerTaseer Ahmed <taseer94@gmail.com>
Wed, 18 Jul 2018 16:20:19 +0000 (21:20 +0500)
This patch introduces a script pointing to the test playbook. A new
build method is added to each of the current jobs, which executes
this script.

Change-Id: Ib950fbb1f8952c794380af03c25f9f4987c65b73
Signed-off-by: Taseer Ahmed <taseer94@gmail.com>
jjb/packaging/ansible.yaml
jjb/packaging/test-ansible-odl-user.sh [new file with mode: 0644]

index 4729fbdb152166d541e6a724fbbc92db988a99e4..3e8185ae9e5bf0d2b7e8b171ac1cef677dcd448d 100644 (file)
@@ -45,6 +45,7 @@
 
     builders:
       - shell: !include-raw: test-ansible-rpm.sh
+      - shell: !include-raw: test-ansible-odl-user.sh
 
     triggers:
       - timed: '@daily'
diff --git a/jjb/packaging/test-ansible-odl-user.sh b/jjb/packaging/test-ansible-odl-user.sh
new file mode 100644 (file)
index 0000000..8e7ad21
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# Options:
+#   -x: Echo commands
+#   -e: Fail on errors
+#   -o pipefail: Fail on errors in scripts this calls, give stacktrace
+set -ex -o pipefail
+
+# Install required packages
+virtualenv rpm_build
+source rpm_build/bin/activate
+rpm_build/bin/python -m pip install --upgrade pip
+
+# Install Ansible
+sudo yum install -y ansible
+
+# Install local version of ansible-opendaylight to path expected by Ansible.
+# Could almost do this by setting ANSIBLE_ROLES_PATH=$WORKSPACE, but Ansible
+# expects the dir containing the role to have the name of role. The JJB project
+# is called "ansible", which causes the cloned repo name to not match the role
+# name "opendaylight". So we need a cp/mv either way and this is simplest.
+sudo cp -R $WORKSPACE/ansible /etc/ansible/roles/opendaylight
+
+# Install OpenDaylight via repo using example Ansible playbook
+sudo ansible-playbook -i "localhost," -c local $WORKSPACE/ansible/examples/rpm_8_devel.yml
+
+# Create Ansible custom module directories
+sudo mkdir -p /usr/share/ansible/plugins/modules
+
+# Copy the custom module to the directory above
+sudo cp $WORKSPACE/ansible/library/odl_usermod.py /usr/share/ansible/plugins/modules/
+
+# Execute the tests playnook
+sudo ansible-playbook -i "localhost," -c local $WORKSPACE/ansible/tests/test-odl-users.yaml -vvv