commit:     c479075032be16a23ebbecf06d5f17bd8881e938
Author:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Fri Jul  9 15:49:39 2021 +0000
Commit:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Fri Jul  9 15:49:39 2021 +0000
URL:        
https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=c4790750

Move setting of project_build_data

Signed-off-by: Magnus Granberg <zorry <AT> gentoo.org>

 buildbot_gentoo_ci/db/builds.py      |  1 -
 buildbot_gentoo_ci/steps/builders.py | 30 ++++++++++++++++--------------
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/buildbot_gentoo_ci/db/builds.py b/buildbot_gentoo_ci/db/builds.py
index 2ad67b8..2cd52bc 100644
--- a/buildbot_gentoo_ci/db/builds.py
+++ b/buildbot_gentoo_ci/db/builds.py
@@ -40,7 +40,6 @@ class BuildsConnectorComponent(base.DBConnectorComponent):
                 q = tbl.insert()
                 r = conn.execute(q, 
dict(project_uuid=project_build_data['project_uuid'],
                                          
version_uuid=project_build_data['version_uuid'],
-                                         
buildbot_build_id=project_build_data['buildbot_build_id'],
                                          status=project_build_data['status'],
                                          
requested=project_build_data['requested'],
                                          created_at=created_at,

diff --git a/buildbot_gentoo_ci/steps/builders.py 
b/buildbot_gentoo_ci/steps/builders.py
index 0bed647..63a1ae9 100644
--- a/buildbot_gentoo_ci/steps/builders.py
+++ b/buildbot_gentoo_ci/steps/builders.py
@@ -189,6 +189,17 @@ class TriggerRunBuildRequest(BuildStep):
 
     @defer.inlineCallbacks
     def run(self):
+        self.gentooci = 
self.master.namedServices['services'].namedServices['gentooci']
+        if self.getProperty('project_build_data') is None:
+            project_build_data = {}
+            project_build_data['project_uuid'] = 
self.getProperty('project_data')['uuid']
+            project_build_data['version_uuid'] = 
self.getProperty("version_data")['uuid']
+            project_build_data['status'] = 'waiting'
+            project_build_data['requested'] = False
+            project_build_data['id'], project_build_data['build_id'] = yield 
self.gentooci.db.builds.addBuild(
+                                                                               
             project_build_data)
+        else:
+            project_build_data = self.getProperty('project_build_data')
         yield self.build.addStepsAfterCurrentStep([
                 steps.Trigger(
                     schedulerNames=['run_build_request'],
@@ -200,7 +211,7 @@ class TriggerRunBuildRequest(BuildStep):
                             'projectrepository_data' : 
self.getProperty('projectrepository_data'),
                             'use_data' : self.getProperty("use_data"),
                             'fullcheck' : self.getProperty("fullcheck"),
-                            'project_build_data' : None
+                            'project_build_data' : project_build_data
                         }
                 )])
         return SUCCESS
@@ -233,6 +244,7 @@ class GetProjectRepositoryData(BuildStep):
                 # set Property projectrepository_data so we can use it in the 
trigger
                 self.setProperty('projectrepository_data', 
projectrepository_data, 'projectrepository_data')
                 self.setProperty('use_data', None, 'use_data')
+                self.setProperty('project_data', project_data, 'project_data')
                 # get name o project keyword
                 project_keyword_data = yield 
self.gentooci.db.keywords.getKeywordById(project_data['keyword_id'])
                 # if not * (all keywords)
@@ -280,22 +292,12 @@ class SetupPropertys(BuildStep):
         self.setProperty('faild_version_data', None, 'faild_version_data')
         self.setProperty('rerun', 0, 'rerun')
         print(self.getProperty("buildnumber"))
-        if self.getProperty('project_build_data') is None:
-            project_build_data = {}
-            project_build_data['project_uuid'] = project_data['uuid']
-            project_build_data['version_uuid'] = 
self.getProperty("version_data")['uuid']
-            project_build_data['status'] = 'in-progress'
-            project_build_data['requested'] = False
-            project_build_data['buildbot_build_id'] = 
self.getProperty("buildnumber")
-            project_build_data['id'], project_build_data['build_id'] = yield 
self.gentooci.db.builds.addBuild(
-                                                                               
             project_build_data)
-        else:
-            project_build_data = self.getProperty('project_build_data')
-            yield self.gentooci.db.builds.setSatusBuilds(
+        project_build_data = self.getProperty('project_build_data')
+        yield self.gentooci.db.builds.setSatusBuilds(
                                                     
project_build_data['build_id'],
                                                     
project_build_data['project_uuid'],
                                                     'in-progress')
-            yield self.gentooci.db.builds.setBuildbotBuildIdBuilds(
+        yield self.gentooci.db.builds.setBuildbotBuildIdBuilds(
                                                     
project_build_data['build_id'],
                                                     
project_build_data['project_uuid'],
                                                     
self.getProperty("buildnumber"))

Reply via email to