Remove duplicated parts from Ansible-ODL CI script 12/76412/3
authorTaseer <taseer94@gmail.com>
Mon, 24 Sep 2018 11:13:20 +0000 (13:13 +0200)
committerTaseer <taseer94@gmail.com>
Mon, 24 Sep 2018 19:40:24 +0000 (21:40 +0200)
This patch moves the common parts of the Ansible-ODL CI scripts
into one script and adds each of the testing parts as separate
builder scripts.

JIRA: INTPAK-197

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

index 3b71487e088af4b77cd6c1230b3498f8be00399d..d1c7f363fb71f319de7e4f022a707690b9450879 100644 (file)
@@ -44,6 +44,7 @@
           build-timeout: '{build-timeout}'
 
     builders:
+      - shell: !include-raw: setup-ansible.sh
       - shell: !include-raw: test-ansible-rpm.sh
       - shell: !include-raw: test-ansible-odl-user.sh
       - shell: !include-raw: test-odl-logs.sh
diff --git a/jjb/packaging/setup-ansible.sh b/jjb/packaging/setup-ansible.sh
new file mode 100644 (file)
index 0000000..eec7cbf
--- /dev/null
@@ -0,0 +1,23 @@
+#!/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
+PYTHON="rpm_build/bin/python"
+$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
index c44c08bb7249e483b6b8a1047e0022dac049fbe6..7535807fd7de9b70adeb4a68bcaa82c6828c6c7a 100644 (file)
@@ -1,11 +1,5 @@
 #!/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
-
 # Create Ansible custom module directories
 sudo mkdir -p /usr/share/ansible/plugins/modules
 
index 4c769ef5bc62d9fa098e5457debf1ce61028714b..df2feb3185dbeb31c0ecdab778dce58147a6289c 100644 (file)
@@ -1,28 +1,4 @@
 #!/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
-PYTHON="rpm_build/bin/python"
-$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_odl_api.yml --extra-vars "@$WORKSPACE/ansible/examples/log_vars.json"
-
-# Add more tests
index 11dc72ab7d27f3f144d6db9fd1cf3cd198454e9f..a8cca75c5f016ef88a391bd4b83874bdec1bbba7 100644 (file)
@@ -1,10 +1,4 @@
 #!/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
-
 # Execute the test ODL logs playbook
 sudo ansible-playbook -i "localhost," -c local $WORKSPACE/ansible/tests/test-odl-logs.yaml -v