예제 #1
0
    def run(self):
        self.log.debug('Inside Execute')
        exit_code = 0

        exit_code = self._check_for_ssh_agent()
        if exit_code > 0:
            return exit_code

        for step in self.steps:
            if step.get('who', None) == self.config['WHO']:
                script = step.get('script', None)
                if not script:
                    error_message = 'No script to execute in step ' \
                        ' {0}'.format(step)
                    raise Exception(error_message)
                self._report_step_status(step.get('id'), \
                    self.STATUS['PROCESSING'])
                script_runner = ScriptRunner(self.job_id,
                    self.shippable_adapter)
                script_status, exit_code, should_continue = \
                    script_runner.execute_script(script)
                self.log.debug(script_status)
                self._report_step_status(step.get('id'), script_status)
                if should_continue is False:
                    break
            else:
                break

        self._push_test_results()
        self._push_coverage_results()

        return exit_code
예제 #2
0
    def run(self):
        self.log.debug('Inside Execute')
        exit_code = 0

        exit_code = self._check_for_ssh_agent()
        if exit_code > 0:
            return exit_code

        for step in self.steps:
            if step.get('who', None) == self.config['WHO']:
                script = step.get('script', None)
                if not script:
                    error_message = 'No script to execute in step ' \
                        ' {0}'.format(step)
                    raise Exception(error_message)
                script_runner = ScriptRunner(self.job_id,
                                             self.shippable_adapter)
                script_status, script_exit_code, should_continue = \
                    script_runner.execute_script(script)
                self._update_exit_code(script_exit_code)
                self.log.debug(script_status)
                if should_continue is False:
                    break
            else:
                break

        self._push_test_results()
        self._push_coverage_results()
        self._push_post_job_envs()

        return self.exit_code
예제 #3
0
    def __execute(self):
        self.log.debug('Executing step')

        if self.step_scripts:
            self.log.debug('Step scripts: {0}'.format(self.step_scripts))
            scripts_execution_success = self.STATUS['SUCCESS']
            for script in self.step_scripts:
                script_runner = ScriptRunner(header_params=self.headers)
                script_status = script_runner.execute_script(script)

                if script_status != self.STATUS['SUCCESS']:
                    scripts_execution_success = script_status

                self.log.debug(
                    'Script competed with status: {0}'.format(script_status))

            self.log.debug('All scripts competed with status: {0}'.format(
                scripts_execution_success))

            coverage_reports = self.__get_coverage_reports()
            self.log.debug('Loaded coverage reports from disk: {0}'.format(
                coverage_reports))
            if coverage_reports:
                self.message['coverageResults'] = coverage_reports

            test_reports = self.__get_test_reports()
            self.log.debug(
                'Loaded test reports from disk: {0}'.format(test_reports))
            if test_reports:
                self.message['testResults'] = test_reports

            return scripts_execution_success
        else:
            self.log.error('No scripts to execute, returning error')
            return self.STATUS['FAILED']
예제 #4
0
파일: execute.py 프로젝트: Riturajcse/cexec
    def run(self):
        self.log.debug("Inside Execute")
        exit_code = 0

        exit_code = self._check_for_ssh_agent()
        if exit_code > 0:
            return exit_code

        for step in self.steps:
            if step.get("who", None) == self.config["WHO"]:
                script = step.get("script", None)
                if not script:
                    error_message = "No script to execute in step " " {0}".format(step)
                    raise Exception(error_message)
                script_runner = ScriptRunner(self.job_id, self.shippable_adapter)
                script_status, script_exit_code, should_continue = script_runner.execute_script(script)
                self._update_exit_code(script_exit_code)
                self.log.debug(script_status)
                if should_continue is False:
                    break
            else:
                break

        self._push_test_results()
        self._push_coverage_results()
        self._push_post_job_envs()

        return self.exit_code
예제 #5
0
파일: execute.py 프로젝트: shrivara/cexec
    def run(self):
        self.log.debug('Inside Execute')
        exit_code = 0
        flushed_consoles_size_in_bytes = 0
        sent_console_truncated_message = False

        exit_code = self._check_for_ssh_agent()
        if exit_code > 0:
            return exit_code

        if self.config['IS_NEW_BUILD_RUNNER_SUBSCRIPTION']:
            self.log.warn('Using new build runner')

        for step in self.steps:
            if step.get('who', None) == self.config['WHO']:
                script = step.get('script', None)
                if not script:
                    error_message = 'No script to execute in step ' \
                        ' {0}'.format(step)
                    raise Exception(error_message)
                if self.config['IS_NEW_BUILD_RUNNER_SUBSCRIPTION']:
                    script_runner = ScriptRunner2(
                        self.job_id, self.shippable_adapter,
                        flushed_consoles_size_in_bytes,
                        sent_console_truncated_message)
                else:
                    script_runner = ScriptRunner(
                        self.job_id, self.shippable_adapter,
                        flushed_consoles_size_in_bytes,
                        sent_console_truncated_message)

                script_status, script_exit_code, should_continue, \
                    flushed_consoles_size_in_bytes, \
                    sent_console_truncated_message = \
                    script_runner.execute_script(script)
                self._update_exit_code(script_exit_code)
                self.log.debug(script_status)
                if should_continue is False:
                    break
            else:
                break

        self._push_test_results()
        self._push_coverage_results()
        self._push_post_job_envs()

        return self.exit_code
예제 #6
0
    def run(self):
        self.log.debug('Inside Execute')
        exit_code = 0
        for step in self.steps:
            if step.get('who', None) == self.config['WHO']:
                script = step.get('script', None)
                if not script:
                    error_message = 'No script to execute in step ' \
                        ' {0}'.format(step)
                script_runner = ScriptRunner(self.job_id,
                    self.shippable_adapter)
                script_status, exit_code, should_continue = script_runner.execute_script(
                    script)
                self.log.debug(script_status)
                self._report_step_status(step.get('id'), script_status)
                if should_continue is False:
                    break
            else:
                break

        return exit_code
예제 #7
0
파일: execute.py 프로젝트: mohit5it9/cexec
    def run(self):
        self.log.debug('Inside Execute')
        exit_code = 0
        flushed_consoles_size_in_bytes = 0
        sent_console_truncated_message = False

        exit_code = self._check_for_ssh_agent()
        if exit_code > 0:
            return exit_code

        for step in self.steps:
            if step.get('who', None) == self.config['WHO']:
                script = step.get('script', None)
                if not script:
                    error_message = 'No script to execute in step ' \
                        ' {0}'.format(step)
                    raise Exception(error_message)
                script_runner = ScriptRunner(self.job_id,
                    self.shippable_adapter, flushed_consoles_size_in_bytes,
                    sent_console_truncated_message)
                script_status, script_exit_code, should_continue, \
                    flushed_consoles_size_in_bytes, \
                    sent_console_truncated_message = \
                    script_runner.execute_script(script)
                self._update_exit_code(script_exit_code)
                self.log.debug(script_status)
                if should_continue is False:
                    break
            else:
                break

        self._push_test_results()
        self._push_coverage_results()
        self._push_post_job_envs()

        return self.exit_code
예제 #8
0
    def __execute(self):
        self.log.debug('Executing step')

        if self.step_scripts:
            self.log.debug('Step scripts: {0}'.format(
                self.step_scripts))
            scripts_execution_success = self.STATUS['SUCCESS']
            for script in self.step_scripts:
                script_runner = ScriptRunner(header_params=self.headers)
                script_status = script_runner.execute_script(script)

                if script_status != self.STATUS['SUCCESS']:
                    scripts_execution_success = script_status

                self.log.debug('Script competed with status: {0}'.format(
                    script_status))

            self.log.debug('All scripts competed with status: {0}'.format(
                scripts_execution_success))

            coverage_reports = self.__get_coverage_reports()
            self.log.debug('Loaded coverage reports from disk: {0}'.format(
                coverage_reports))
            if coverage_reports:
                self.message['coverageResults'] = coverage_reports

            test_reports = self.__get_test_reports()
            self.log.debug('Loaded test reports from disk: {0}'.format(
                test_reports))
            if test_reports:
                self.message['testResults'] = test_reports

            return scripts_execution_success
        else:
            self.log.error('No scripts to execute, returning error')
            return self.STATUS['FAILED']