From 6171182755e1b643be9205edae0a81d284bdab99 Mon Sep 17 00:00:00 2001 From: Magnus Granberg Date: Thu, 21 Mar 2024 17:56:34 +0100 Subject: Add bb log id for build steps Signed-off-by: Magnus Granberg --- buildbot_gentoo_ci/steps/builders.py | 9 +++++++-- buildbot_gentoo_ci/steps/logs.py | 15 ++++++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/buildbot_gentoo_ci/steps/builders.py b/buildbot_gentoo_ci/steps/builders.py index 0ac8526..c033196 100644 --- a/buildbot_gentoo_ci/steps/builders.py +++ b/buildbot_gentoo_ci/steps/builders.py @@ -347,13 +347,19 @@ class SetupPropertys(BuildStep): self.setProperty('rerun', 0, 'rerun') project_build_data = self.getProperty('project_build_data') project_build_data['status'] = 'in-progress' - project_build_data['buildbot_build_id'] = self.getProperty("buildnumber") yield self.gentooci.db.builds.setStatusBuilds( project_build_data['id'], project_build_data['status']) + builder_id = yield self.master.db.builders.findBuilderId(self.getProperty("buildername"), autoCreate=False) + print(builder_id) + build_data = yield self.master.db.builds.getBuildByNumber(builder_id ,self.getProperty("buildnumber")) + print(build_data) + project_build_data['buildbot_build_id'] = build_data['id'] yield self.gentooci.db.builds.setBuildbotBuildIdBuilds( project_build_data['id'], project_build_data['buildbot_build_id']) + project_build_data['builder_id'] = builder_id + project_build_data['buildnumber'] = self.getProperty("buildnumber") self.setProperty('project_build_data', project_build_data, 'project_build_data') print(self.getProperty("project_build_data")) self.masterdest = yield os.path.join(self.master.basedir, 'workers', self.getProperty('workername'), str(self.getProperty("buildnumber"))) @@ -1082,7 +1088,6 @@ class CheckEmergeLogs(BuildStep): 'pkg_check_log_data' : self.getProperty("pkg_check_log_data"), 'repository_data' : self.getProperty('repository_data'), 'faild_cpv' : self.faild_cpv, - 'step' : self.step, 'build_workername' : self.getProperty('workername') } )) diff --git a/buildbot_gentoo_ci/steps/logs.py b/buildbot_gentoo_ci/steps/logs.py index b6c97b7..896778c 100644 --- a/buildbot_gentoo_ci/steps/logs.py +++ b/buildbot_gentoo_ci/steps/logs.py @@ -104,8 +104,21 @@ class SetupPropertys(BuildStep): self.setProperty("log_cpv", log_cpv, 'log_cpv') self.setProperty("bgo", False, 'bgo') self.descriptionDone = 'Runing log checker on ' + log_cpv - logsdir = yield os.path.join(self.master.basedir, 'workers', self.getProperty('build_workername'), str(self.getProperty("project_build_data")['buildbot_build_id'])) + logsdir = yield os.path.join(self.master.basedir, 'workers', self.getProperty('build_workername'), str(self.getProperty("project_build_data")['buildnumber'])) self.setProperty("logsdir", logsdir, 'logsdir') + # get steps/log id's from build + build_log_steps_data = {} + steps_data = yield self.master.db.steps.getSteps(self.getProperty("project_build_data")['buildbot_build_id']) + print(steps_data) + for step in steps_data: + logs_data = yield self.master.db.logs.getLogs(step['id']) + print(logs_data) + step_info = {} + step_info['name'] = step['name'] + step_info['number'] = step['number'] + step_info['log_data'] = logs_data + build_log_steps_data[step['id']] = step_info + self.setProperty("build_log_steps_data", build_log_steps_data, 'build_log_steps_data') return SUCCESS class SetupParserBuildLoger(BuildStep): -- cgit v1.2.3-65-gdbad