@@ -446,6 +446,26 @@ def is_final(v):
446446 for payload_el , params_el in zip (payload , params ):
447447 cls ._merge_payload_with_extra_params (payload_el , params_el )
448448
449+ def _inject_extra_params (self , payload : dict ) -> dict :
450+ if not hasattr (self .job_config , "tf_extra_params" ):
451+ return payload
452+
453+ extra_params = self .job_config .tf_extra_params
454+ # Merge only some subtrees, we do not want the user to override notification or api_key!
455+ for subtree in TESTING_FARM_EXTRA_PARAM_MERGED_SUBTREES :
456+ if subtree not in extra_params :
457+ continue
458+
459+ if subtree not in payload :
460+ payload [subtree ] = extra_params [subtree ]
461+ else :
462+ self ._merge_payload_with_extra_params (
463+ payload [subtree ],
464+ extra_params [subtree ],
465+ )
466+
467+ return payload
468+
449469 @classmethod
450470 def _handle_extra_artifacts (cls , payload : Any , extra_params_artifacts : Any ):
451471 """
@@ -599,23 +619,7 @@ def _payload(
599619 },
600620 }
601621
602- if hasattr (self .job_config , "tf_extra_params" ):
603- extra_params = self .job_config .tf_extra_params
604- else :
605- extra_params = {}
606- # Merge only some subtrees, we do not want the user to override notification or api_key!
607- for subtree in TESTING_FARM_EXTRA_PARAM_MERGED_SUBTREES :
608- if subtree not in extra_params :
609- continue
610- if subtree not in payload :
611- payload [subtree ] = extra_params [subtree ]
612- else :
613- self ._merge_payload_with_extra_params (
614- payload [subtree ],
615- extra_params [subtree ],
616- )
617-
618- return payload
622+ return self ._inject_extra_params (payload )
619623
620624 def _payload_install_test (self , build_id : int , target : str , compose : str ) -> dict :
621625 """
@@ -625,31 +629,33 @@ def _payload_install_test(self, build_id: int, target: str, compose: str) -> dic
625629 """
626630 copr_build = CoprBuildTargetModel .get_by_build_id (build_id )
627631 distro , arch = target .rsplit ("-" , 1 )
628- return {
629- "api_key" : self .service_config .testing_farm_secret ,
630- "test" : {
631- "tmt" : {
632- "url" : TESTING_FARM_INSTALLABILITY_TEST_URL ,
633- "ref" : TESTING_FARM_INSTALLABILITY_TEST_REF ,
634- "name" : "/packit/installation" ,
635- },
636- },
637- "environments" : [
638- {
639- "arch" : arch ,
640- "os" : {"compose" : compose },
641- "variables" : {
642- "REPOSITORY" : f"{ copr_build .owner } /{ copr_build .project_name } " ,
632+ return self ._inject_extra_params (
633+ {
634+ "api_key" : self .service_config .testing_farm_secret ,
635+ "test" : {
636+ "tmt" : {
637+ "url" : TESTING_FARM_INSTALLABILITY_TEST_URL ,
638+ "ref" : TESTING_FARM_INSTALLABILITY_TEST_REF ,
639+ "name" : "/packit/installation" ,
643640 },
644641 },
645- ],
646- "notification" : {
647- "webhook" : {
648- "url" : f"{ self .api_url } /testing-farm/results" ,
649- "token" : self .service_config .testing_farm_secret ,
642+ "environments" : [
643+ {
644+ "arch" : arch ,
645+ "os" : {"compose" : compose },
646+ "variables" : {
647+ "REPOSITORY" : f"{ copr_build .owner } /{ copr_build .project_name } " ,
648+ },
649+ },
650+ ],
651+ "notification" : {
652+ "webhook" : {
653+ "url" : f"{ self .api_url } /testing-farm/results" ,
654+ "token" : self .service_config .testing_farm_secret ,
655+ },
650656 },
651- },
652- }
657+ }
658+ )
653659
654660 def check_comment_pr_argument_and_report (self ) -> bool :
655661 """
0 commit comments