diff options
-rw-r--r-- | build-gluster-org/jobs/distributed-regression.yml | 59 | ||||
-rw-r--r-- | build-gluster-org/scripts/distributed-regression.py | 25 |
2 files changed, 84 insertions, 0 deletions
diff --git a/build-gluster-org/jobs/distributed-regression.yml b/build-gluster-org/jobs/distributed-regression.yml new file mode 100644 index 0000000..513f108 --- /dev/null +++ b/build-gluster-org/jobs/distributed-regression.yml @@ -0,0 +1,59 @@ +- job: + name: distributed-regression + node: regression7 + description: Run regression with distributed test framework + project-type: freestyle + concurrent: true + + scm: + - git: + branches: + - $GERRIT_BRANCH + refspec: $GERRIT_REFSPEC + choosing-strategy: gerrit + url: git://review.gluster.org/glusterfs.git + + properties: + - discard-after-x: + x: 30 + - one-build-per-node + + triggers: + - timed: "0 */4 * * *" + + parameters: + - string: + default: refs/heads/master + description: 'For review 12345 and patch set 6, this will be refs/changes/45/12345/6. Default: Tip of master' + name: GERRIT_REFSPEC + - string: + default: master + description: 'Name of the branch you want to build from. We usually build from master' + name: GERRIT_BRANCH + - string: + default: '4' + description: Number of machines to launch + name: MACHINES_COUNT + + builders: + - shell: | + ssh-keygen -f ${WORKSPACE}/key -t rsa -b 4096 + /opt/qa/distributed-tests/rackspace-server-manager.py create -n ${MACHINES_COUNT} + - ansible-playbook: + playbook: '/opt/qa/distributed-tests/distributed-server.yml' + inventory-type: 'path' + inventory: + path: ${WORKSPACE}/hosts + - conditional-step: + condition-kind: shell + condition-command: !include-raw: ../scripts/distributed-regression.py + steps: + - shell: /opt/qa/distributed-tests/rackspace-server-manager.py delete + + wrappers: + - timestamps + - credentials-binding: + - username-password-separated: + credential-id: e423d7f9-edaf-45ea-aa8f-9c3f8e6563f1 + username: USERNAME + password: PASSWORD diff --git a/build-gluster-org/scripts/distributed-regression.py b/build-gluster-org/scripts/distributed-regression.py new file mode 100644 index 0000000..4938979 --- /dev/null +++ b/build-gluster-org/scripts/distributed-regression.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +import subprocess +from ansible.parsing.dataloader import DataLoader +from ansible.vars.manager import VariableManager +from ansible.inventory.manager import InventoryManager + + +def get_ansible_host_ip(): + loader = DataLoader() + inventory = InventoryManager(loader=loader, sources='hosts') + variable_manager = VariableManager(loader=loader, inventory=inventory) + hostnames = [] + for host in inventory.get_hosts(): + hostnames.append(variable_manager.get_vars(host=host)) + ip='\t'.join([str(i['ansible_host']) for i in hostnames]) + return ip + + +def main(): + ip = get_ansible_host_ip() + subprocess.call('/extras/distributed-testing/distributed-test.sh ' + '--hosts {0} --id_rsa {1}'.format(ip, ${WORKSPACE}/key)) + + +main() |