def job_30_run(self, cr, uid, build, lock_path, log_path): 'Run docker container with odoo server started' if not build.branch_id.repo_id.is_travis2docker_build: return super(RunbotBuild, self).job_30_run( cr, uid, build, lock_path, log_path) skip = build.skip_check(cr, uid, build, context={}) if skip: return skip # Start copy and paste from original method (fix flake8) log_all = build.path('logs', 'job_20_test_all.txt') log_time = time.localtime(os.path.getmtime(log_all)) v = { 'job_end': time.strftime( openerp.tools.DEFAULT_SERVER_DATETIME_FORMAT, log_time), } if grep(log_all, ".modules.loading: Modules loaded."): if rfind(log_all, _re_error): v['result'] = "ko" elif rfind(log_all, _re_warning): v['result'] = "warn" elif not grep( build.server("test/common.py"), "post_install") or grep( log_all, "Initiating shutdown."): v['result'] = "ok" else: v['result'] = "ko" build.write(v) build.github_status() # end copy and paste from original method cmd = ['docker', 'start', '-i', build.docker_container] return self.spawn(cmd, lock_path, log_path)
def _job_30_run(self, cr, uid, build, lock_path, log_path): if build.repo_id.db_name and build.state == 'running' and build.result == "ko": return 0 runbot._re_error = self._get_regexeforlog(build=build, errlevel='error') runbot._re_warning = self._get_regexeforlog(build=build, errlevel='warning') build._log('run', 'Start running build %s' % build.dest) v = {} result = "ok" log_names = [elmt.name for elmt in build.repo_id.parse_job_ids] for log_name in log_names: log_all = build._path('logs', log_name + '.txt') if grep(log_all, ".modules.loading: Modules loaded."): if rfind(log_all, runbot._re_error): result = "ko" break elif rfind(log_all, runbot._re_warning): result = "warn" elif not grep(build._server("test/common.py"), "post_install") or grep(log_all, "Initiating shutdown."): if result != "warn": result = "ok" else: result = "ko" break log_time = time.localtime(os.path.getmtime(log_all)) v['job_end'] = time.strftime( openerp.tools.DEFAULT_SERVER_DATETIME_FORMAT, log_time) v['result'] = result build.write(v) build._github_status() # run server cmd, mods = build._cmd() if os.path.exists(build._server('addons/im_livechat')): cmd += ["--workers", "2"] cmd += ["--longpolling-port", "%d" % (build.port + 1)] cmd += ["--max-cron-threads", "1"] else: # not sure, to avoid old server to check other dbs cmd += ["--max-cron-threads", "0"] cmd += ['-d', "%s-all" % build.dest] if grep(build._server("tools/config.py"), "db-filter"): if build.repo_id.nginx: cmd += ['--db-filter', '%d.*'] else: cmd += ['--db-filter', '%s.*$' % build.dest] return self._spawn(cmd, lock_path, log_path, cpu_limit=None)
def job_30_run(self, cr, uid, build, lock_path, log_path): if build.repo_id.db_name and build.state == 'running' and build.result == "ko": return 0 runbot._re_error = self._get_regexeforlog(build=build, errlevel='error') runbot._re_warning = self._get_regexeforlog(build=build, errlevel='warning') build._log('run', 'Start running build %s' % build.dest) v = {} result = "ok" log_names = [elmt.name for elmt in build.repo_id.parse_job_ids] for log_name in log_names: log_all = build.path('logs', log_name+'.txt') if grep(log_all, ".modules.loading: Modules loaded."): if rfind(log_all, runbot._re_error): result = "ko" break; elif rfind(log_all, runbot._re_warning): result = "warn" elif not grep(build.server("test/common.py"), "post_install") or grep(log_all, "Initiating shutdown."): if result != "warn": result = "ok" else: result = "ko" break; log_time = time.localtime(os.path.getmtime(log_all)) v['job_end'] = time.strftime(openerp.tools.DEFAULT_SERVER_DATETIME_FORMAT, log_time) v['result'] = result build.write(v) build.github_status() # run server cmd, mods = build.cmd() if os.path.exists(build.server('addons/im_livechat')): cmd += ["--workers", "2"] cmd += ["--longpolling-port", "%d" % (build.port + 1)] cmd += ["--max-cron-threads", "1"] else: # not sure, to avoid old server to check other dbs cmd += ["--max-cron-threads", "0"] cmd += ['-d', "%s-all" % build.dest] if grep(build.server("tools/config.py"), "db-filter"): if build.repo_id.nginx: cmd += ['--db-filter','%d.*'] else: cmd += ['--db-filter','%s.*$' % build.dest] return self.spawn(cmd, lock_path, log_path, cpu_limit=None)
def job_20_test_all(self, build, lock_path, log_path): if build.repo_id.docoverage: build._log('test_all', 'Start test all modules') path = build.path() self.pg_createdb("%s-all" % build.dest) cmd, mods = build.cmd() if grep(build.server("tools/config.py"), "test-enable"): cmd.append("--test-enable") cmd += [ '-d', '%s-all' % build.dest, '-i', mods, '--stop-after-init', '--log-level=test', '--max-cron-threads=0' ] cmd = ['coverage', 'run', '--include=openerp/addons/*'] + cmd[1:] # reset job_start to an accurate job_20 job_time build.write({'job_start': now()}) build._log('job_20_coverage', " ".join(cmd)) return self.spawncwd(cmd, lock_path, log_path, cpu_limit=3500, cwd=path) else: return super(runbot_build, self).job_20_test_all(build, lock_path, log_path)