예제 #1
0
    def runJob(self, db, nodepool):
        if self.node_id:
            nodepool.deleteNode(self.node_id)
            self.update(db, node_id=0)

        node_id, node_ip = nodepool.getNode()

        if not node_id:
            return
        self.log.info("Running job for %s on %s/%s"%(self, node_id, node_ip))

        if not utils.testSSH(node_ip, Configuration().NODE_USERNAME, Configuration().NODE_KEY):
            self.log.error('Failed to get SSH object for node %s/%s.  Deleting node.'%(node_id, node_ip))
            nodepool.deleteNode(node_id)
            self.update(db, node_id=0)
            return

        self.update(db, node_id=node_id, node_ip=node_ip, result='')

        cmd = 'echo %s >> run_tests_env' % ' '.join(instructions.check_out_testrunner())
        utils.execute_command('ssh -q -o BatchMode=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i %s %s@%s %s'%(
                Configuration().NODE_KEY, Configuration().NODE_USERNAME, node_ip, cmd))
        cmd = 'echo "%s %s" >> run_tests_env' % (
            ' '.join(environment.get_environment(self.change_ref)),
            ' '.join(instructions.execute_test_runner()))
        utils.execute_command('ssh -q -o BatchMode=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i %s %s@%s %s'%(
                Configuration().NODE_KEY, Configuration().NODE_USERNAME, node_ip, cmd))
        # For some reason invoking this immediately fails...
        time.sleep(5)
        utils.execute_command('ssh$-q$-o$BatchMode=yes$-o$UserKnownHostsFile=/dev/null$-o$StrictHostKeyChecking=no$-i$%s$%s@%s$nohup bash /home/jenkins/run_tests_env < /dev/null > run_tests.log 2>&1 &'%(
                Configuration().NODE_KEY, Configuration().NODE_USERNAME, node_ip), '$')
        self.update(db, state=constants.RUNNING)
예제 #2
0
    def runJob(self, db, nodepool):
        if self.node_id:
            nodepool.deleteNode(self.node_id)
            self.update(db, node_id=0)

        node_id, node_ip = nodepool.getNode()

        if not node_id:
            return
        self.log.info("Running job for %s on %s/%s"%(self, node_id, node_ip))

        if not utils.testSSH(node_ip, Configuration().NODE_USERNAME, Configuration().NODE_KEY):
            self.log.error('Failed to get SSH object for node %s/%s.  Deleting node.'%(node_id, node_ip))
            nodepool.deleteNode(node_id)
            self.update(db, node_id=0)
            return

        self.update(db, node_id=node_id, node_ip=node_ip, result='')

        instruction_list = ["#!/bin/bash"]
        for instruction in instructions.update_devstackgate('origin/master'):
            instruction_list.append(" ".join(instruction))
        instruction_list.append(" ".join(instructions.check_out_testrunner()))
        if self.project_name == 'openstack/xenapi-os-testing':
            for instruction in instructions.update_testrunner(self.change_ref):
                instruction_list.append(" ".join(instruction))
        instruction_list.append("%s %s"%(" ".join(environment.get_environment(self.project_name, self.change_ref, self.branch)),
                                         " ".join(instructions.execute_test_runner())))

        for instruction in instruction_list:
            cmd = 'echo "%s" >> run_tests_env' % instruction
            utils.execute_command('ssh -q -o BatchMode=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i %s %s@%s %s'%(
                Configuration().NODE_KEY, Configuration().NODE_USERNAME, node_ip, cmd))
        cmd = "chmod +x run_tests_env"
        utils.execute_command('ssh -q -o BatchMode=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i %s %s@%s %s'%(
            Configuration().NODE_KEY, Configuration().NODE_USERNAME, node_ip, cmd))
        # For some reason invoking this immediately fails...
        time.sleep(5)
        utils.execute_command('ssh$-q$-o$BatchMode=yes$-o$UserKnownHostsFile=/dev/null$-o$StrictHostKeyChecking=no$-i$%s$%s@%s$'\
                              'nohup bash -c "source /opt/git/openstack-infra/devstack-gate/functions.sh; tsfilter /home/jenkins/run_tests_env" < /dev/null > run_tests.log 2>&1 &'%(
                Configuration().NODE_KEY, Configuration().NODE_USERNAME, node_ip), '$')
        self.update(db, state=constants.RUNNING)
예제 #3
0
    def runJob(self, db, nodepool):
        if self.node_id:
            nodepool.deleteNode(self.node_id)
            self.update(db, node_id=0)

        node_id, node_ip = nodepool.getNode()

        if not node_id:
            return
        self.log.info("Running job for %s on %s/%s"%(self, node_id, node_ip))

        if not utils.testSSH(node_ip, Configuration().NODE_USERNAME, Configuration().NODE_KEY):
            self.log.error('Failed to get SSH object for node %s/%s.  Deleting node.'%(node_id, node_ip))
            nodepool.deleteNode(node_id)
            self.update(db, node_id=0)
            return

        self.update(db, node_id=node_id, node_ip=node_ip, result='')

        instruction_list = ["#!/bin/bash"]
        for instruction in instructions.update_devstackgate('origin/master'):
            instruction_list.append(" ".join(instruction))
        instruction_list.append(" ".join(instructions.check_out_testrunner()))
        if self.project_name == 'stackforge/xenapi-os-testing':
            for instruction in instructions.update_testrunner(self.change_ref):
                instruction_list.append(" ".join(instruction))
        instruction_list.append("%s %s"%(" ".join(environment.get_environment(self.project_name, self.change_ref)),
                                         " ".join(instructions.execute_test_runner())))

        for instruction in instruction_list:
            cmd = 'echo "%s" >> run_tests_env' % instruction
            utils.execute_command('ssh -q -o BatchMode=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i %s %s@%s %s'%(
                Configuration().NODE_KEY, Configuration().NODE_USERNAME, node_ip, cmd))
        cmd = "chmod +x run_tests_env"
        utils.execute_command('ssh -q -o BatchMode=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i %s %s@%s %s'%(
            Configuration().NODE_KEY, Configuration().NODE_USERNAME, node_ip, cmd))
        # For some reason invoking this immediately fails...
        time.sleep(5)
        utils.execute_command('ssh$-q$-o$BatchMode=yes$-o$UserKnownHostsFile=/dev/null$-o$StrictHostKeyChecking=no$-i$%s$%s@%s$'\
                              'nohup bash -c "source /opt/git/openstack-infra/devstack-gate/functions.sh; tsfilter /home/jenkins/run_tests_env" < /dev/null > run_tests.log 2>&1 &'%(
                Configuration().NODE_KEY, Configuration().NODE_USERNAME, node_ip), '$')
        self.update(db, state=constants.RUNNING)