]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-ansible-scenario: create an individual scenario job 697/head
authorAlfredo Deza <adeza@redhat.com>
Fri, 28 Apr 2017 20:02:23 +0000 (16:02 -0400)
committerAlfredo Deza <adeza@redhat.com>
Fri, 28 Apr 2017 20:08:26 +0000 (16:08 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
ceph-ansible-scenario/build/build [new file with mode: 0644]
ceph-ansible-scenario/build/teardown [new file with mode: 0644]
ceph-ansible-scenario/config/definitions/ceph-ansible-scenario.yml [new file with mode: 0644]

diff --git a/ceph-ansible-scenario/build/build b/ceph-ansible-scenario/build/build
new file mode 100644 (file)
index 0000000..9da5957
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# the following two methods exist in scripts/build_utils.sh
+pkgs=( "tox" )
+install_python_packages "pkgs[@]"
+
+# XXX this might not be needed
+source $VENV/activate
+
+WORKDIR=$(mktemp -td tox.XXXXXXXXXX)
+
+# Sometimes, networks may linger around, so we must ensure they are killed:
+networks=`sudo virsh net-list --all | grep active | egrep -v "(default|libvirt)" | cut -d ' ' -f 2`
+for network in $networks; do
+    sudo virsh net-destroy $network || true
+    sudo virsh net-undefine $network || true
+done
+
+# restart libvirt services
+sudo service libvirt-bin restart
+sudo service libvirt-guests restart
+
+# the $SCENARIO var is injected by the job configuration. It maps
+# to an actual, defined, tox environment
+$VENV/tox -rv -e=$SCENARIO --workdir=$WORKDIR -- --provider=libvirt
diff --git a/ceph-ansible-scenario/build/teardown b/ceph-ansible-scenario/build/teardown
new file mode 100644 (file)
index 0000000..27b9bfa
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+# There has to be a better way to do this than this script which just looks
+# for every Vagrantfile in scenarios and then just destroys whatever is left.
+
+cd $WORKSPACE/tests
+
+scenarios=$(find . | grep Vagrantfile | xargs dirname)
+
+for scenario in $scenarios; do
+    cd $scenario
+    vagrant destroy -f
+    cd -
+done
+
+# Sometimes, networks may linger around, so we must ensure they are killed:
+networks=`sudo virsh net-list --all | grep active | egrep -v "(default|libvirt)" | cut -d ' ' -f 2`
+for network in $networks; do
+    sudo virsh net-destroy $network || true
+    sudo virsh net-undefine $network || true
+done
diff --git a/ceph-ansible-scenario/config/definitions/ceph-ansible-scenario.yml b/ceph-ansible-scenario/config/definitions/ceph-ansible-scenario.yml
new file mode 100644 (file)
index 0000000..dddd58f
--- /dev/null
@@ -0,0 +1,52 @@
+
+- job:
+    name: 'ceph-ansible-scenario'
+    node: vagrant&&libvirt
+    concurrent: false
+    defaults: global
+    display-name: 'ceph-ansible: individual scenario testing'
+    quiet-period: 5
+    block-downstream: false
+    block-upstream: false
+    retry-count: 3
+    properties:
+      - github:
+          url: https://github.com/ceph/ceph-ansible
+    logrotate:
+      daysToKeep: 15
+      numToKeep: 30
+      artifactDaysToKeep: -1
+      artifactNumToKeep: -1
+
+    parameters:
+      - string:
+          name: SCENARIO
+          description: "A full scenario name for ceph-ansible testing, like jewel-ansible2.2-purge_cluster"
+      - string:
+          name: BRANCH
+          description: "The ceph-ansible branch to test against"
+          default: "master"
+
+    scm:
+      - git:
+          url: https://github.com/ceph/ceph-ansible.git
+          branches:
+            - $BRANCH
+          refspec: +refs/pull/*:refs/remotes/origin/pr/*
+          browser: auto
+          timeout: 20
+          skip-tag: true
+          wipe-workspace: false
+
+    builders:
+      - shell:
+          !include-raw-escape:
+            - ../../../scripts/build_utils.sh
+            - ../../build/build
+
+    publishers:
+      - postbuildscript:
+          script-only-if-succeeded: False
+          script-only-if-failed: True
+          builders:
+            - shell: !include-raw ../../build/teardown