@@ -298,6 +298,22 @@ def get_arch_by_name(models, name):
298298 def __repr__ (self ):
299299 return self .name
300300
301+ class ChainBuild (Model ):
302+ required_fields = ['id' , 'arches' ]
303+
304+ def load (self ):
305+ self .params_dict = self .init_data
306+ self .cacher = lt_cache
307+
308+ def get_init_data (self , ID ):
309+ ID = str (ID )
310+ self .init_data = self .models .jsn .get_chain_build_by_id (ID )['chain_build' ]
311+
312+ @staticmethod
313+ def last (models ):
314+ chain_build = models .jsn .get_last_chain_build ()['chain_build' ]
315+ return ChainBuild (models , init_data = chain_build )
316+
301317class User (Model ):
302318 required_fields = ['id' , 'name' , 'email' , 'language' , 'professional_experience' , 'site' , 'company' , 'location' ,
303319 'uname' , 'own_projects_count' , 'build_priority' , 'created_at' , 'updated_at' , 'avatar_url' , 'html_url' ]
@@ -575,7 +591,8 @@ def new_build_task(models,
575591 include_testing_subrepo ,
576592 use_extra_tests ,
577593 extra_build_lists ,
578- external_nodes ):
594+ external_nodes ,
595+ chain_config ):
579596 if external_nodes == 'none' :
580597 DATA = {
581598 'project_id' : project .id ,
@@ -593,7 +610,8 @@ def new_build_task(models,
593610 'extra_repositories' : [],
594611 'extra_build_lists' : extra_build_lists ,
595612 'include_testing_subrepository' : include_testing_subrepo ,
596- 'use_extra_tests' : use_extra_tests
613+ 'use_extra_tests' : use_extra_tests ,
614+ 'chain_config' : chain_config
597615 }
598616 else :
599617 DATA = {
@@ -613,7 +631,8 @@ def new_build_task(models,
613631 'extra_build_lists' : extra_build_lists ,
614632 'include_testing_subrepository' : include_testing_subrepo ,
615633 'use_extra_tests' : use_extra_tests ,
616- 'external_nodes' : external_nodes
634+ 'external_nodes' : external_nodes ,
635+ 'chain_config' : chain_config
617636 }
618637
619638 build_platforms = {}
@@ -641,8 +660,21 @@ def new_build_task(models,
641660 'notify the console-client developers. Send them a set of command-line arguments and the request data:\n %s' ) % DATA )
642661 exit (1 )
643662 if result ['build_list' ]['id' ] is not None :
644- log .info (_ ("Task %(proj)s|%(plat)s|%(save_repo)s|%(arch)s has been sent. Build task id is %(id)s" ) %
645- {'proj' : project , 'plat' : bpl , 'save_repo' : save_to_repository , 'arch' : arch , 'id' : result ['build_list' ]['id' ]})
663+ if 'chain_build_id' in result ['build_list' ]:
664+ if 'create_chain' in DATA ['chain_config' ]:
665+ DATA ['chain_config' ] = {'add_first' : result ['build_list' ]['chain_build_id' ]}
666+ log .info (_ ("Task %(proj)s|%(plat)s|%(save_repo)s|%(arch)s has been sent. Build task id is %(id)s. Chain build id is %(chain_build_id)s" ) %
667+ {
668+ 'proj' : project ,
669+ 'plat' : bpl ,
670+ 'save_repo' : save_to_repository ,
671+ 'arch' : arch , 'id' : result ['build_list' ]['id' ],
672+ 'chain_build_id' : result ['build_list' ]['chain_build_id' ]
673+ }
674+ )
675+ else :
676+ log .info (_ ("Task %(proj)s|%(plat)s|%(save_repo)s|%(arch)s has been sent. Build task id is %(id)s" ) %
677+ {'proj' : project , 'plat' : bpl , 'save_repo' : save_to_repository , 'arch' : arch , 'id' : result ['build_list' ]['id' ]})
646678 else :
647679 log .info (_ ("Build request %(proj)s|%(plat)s|%(save_repo)s|%(arch)s has failed.\n Reason: %(reason)s" ) %
648680 {'proj' : project , 'plat' : bpl , 'save_repo' : save_to_repository , 'arch' : arch , 'reason' : result ['build_list' ]['message' ]})
0 commit comments