@@ -112,7 +112,7 @@ def main():
112112
113113 previous_id = args .consumer_start_id
114114 while True :
115- previous_id = builder_process_stream (
115+ previous_id , new_builds_count = builder_process_stream (
116116 builders_folder , conn , different_build_specs , previous_id
117117 )
118118
@@ -138,14 +138,16 @@ def builder_consumer_group_create(conn):
138138
139139
140140def builder_process_stream (builders_folder , conn , different_build_specs , previous_id ):
141+ new_builds_count = 0
141142 logging .info ("Entering blocking read waiting for work." )
143+ consumer_name = "{}-proc#{}" .format (STREAM_GH_EVENTS_COMMIT_BUILDERS_CG , "1" )
142144 newTestInfo = conn .xreadgroup (
143145 STREAM_GH_EVENTS_COMMIT_BUILDERS_CG ,
144- "{}-proc#{}" . format ( STREAM_GH_EVENTS_COMMIT_BUILDERS_CG , "1" ) ,
146+ consumer_name ,
145147 {STREAM_KEYNAME_GH_EVENTS_COMMIT : previous_id },
146148 count = 1 ,
147- block = 0 ,
148149 )
150+
149151 if len (newTestInfo [0 ]) < 2 or len (newTestInfo [0 ][1 ]) < 1 :
150152 previous_id = ">"
151153 else :
@@ -162,6 +164,9 @@ def builder_process_stream(builders_folder, conn, different_build_specs, previou
162164 git_hash = testDetails [b"git_hash" ]
163165 logging .info ("Received commit hash specifier {}." .format (git_hash ))
164166 buffer = testDetails [b"zip_archive" ]
167+ git_branch = None
168+ if b"git_branch" in testDetails :
169+ git_branch = testDetails [b"git_branch" ]
165170
166171 for build_spec in different_build_specs :
167172 build_config , id = get_build_config (builders_folder + "/" + build_spec )
@@ -239,6 +244,8 @@ def builder_process_stream(builders_folder, conn, different_build_specs, previou
239244 "build_command" : build_command ,
240245 "build_artifacts" : "," .join (build_artifacts ),
241246 }
247+ if git_branch is not None :
248+ build_stream_fields ["git_branch" ] = git_branch
242249 for artifact in build_artifacts :
243250 bin_artifact = open (
244251 "{}src/{}" .format (redis_temporary_dir , artifact ), "rb"
@@ -258,9 +265,15 @@ def builder_process_stream(builders_folder, conn, different_build_specs, previou
258265 )
259266 )
260267 shutil .rmtree (temporary_dir , ignore_errors = True )
268+ new_builds_count = new_builds_count + 1
269+ conn .xack (
270+ STREAM_GH_EVENTS_COMMIT_BUILDERS_CG ,
271+ STREAM_KEYNAME_GH_EVENTS_COMMIT ,
272+ streamId ,
273+ )
261274 else :
262275 logging .error ("Missing commit information within received message." )
263- return previous_id
276+ return previous_id , new_builds_count
264277
265278
266279def build_spec_image_prefetch (builders_folder , different_build_specs ):
0 commit comments