@@ -112,7 +112,7 @@ def main():
112
112
113
113
previous_id = args .consumer_start_id
114
114
while True :
115
- previous_id = builder_process_stream (
115
+ previous_id , new_builds_count = builder_process_stream (
116
116
builders_folder , conn , different_build_specs , previous_id
117
117
)
118
118
@@ -138,14 +138,16 @@ def builder_consumer_group_create(conn):
138
138
139
139
140
140
def builder_process_stream (builders_folder , conn , different_build_specs , previous_id ):
141
+ new_builds_count = 0
141
142
logging .info ("Entering blocking read waiting for work." )
143
+ consumer_name = "{}-proc#{}" .format (STREAM_GH_EVENTS_COMMIT_BUILDERS_CG , "1" )
142
144
newTestInfo = conn .xreadgroup (
143
145
STREAM_GH_EVENTS_COMMIT_BUILDERS_CG ,
144
- "{}-proc#{}" . format ( STREAM_GH_EVENTS_COMMIT_BUILDERS_CG , "1" ) ,
146
+ consumer_name ,
145
147
{STREAM_KEYNAME_GH_EVENTS_COMMIT : previous_id },
146
148
count = 1 ,
147
- block = 0 ,
148
149
)
150
+
149
151
if len (newTestInfo [0 ]) < 2 or len (newTestInfo [0 ][1 ]) < 1 :
150
152
previous_id = ">"
151
153
else :
@@ -162,6 +164,9 @@ def builder_process_stream(builders_folder, conn, different_build_specs, previou
162
164
git_hash = testDetails [b"git_hash" ]
163
165
logging .info ("Received commit hash specifier {}." .format (git_hash ))
164
166
buffer = testDetails [b"zip_archive" ]
167
+ git_branch = None
168
+ if b"git_branch" in testDetails :
169
+ git_branch = testDetails [b"git_branch" ]
165
170
166
171
for build_spec in different_build_specs :
167
172
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
239
244
"build_command" : build_command ,
240
245
"build_artifacts" : "," .join (build_artifacts ),
241
246
}
247
+ if git_branch is not None :
248
+ build_stream_fields ["git_branch" ] = git_branch
242
249
for artifact in build_artifacts :
243
250
bin_artifact = open (
244
251
"{}src/{}" .format (redis_temporary_dir , artifact ), "rb"
@@ -258,9 +265,15 @@ def builder_process_stream(builders_folder, conn, different_build_specs, previou
258
265
)
259
266
)
260
267
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
+ )
261
274
else :
262
275
logging .error ("Missing commit information within received message." )
263
- return previous_id
276
+ return previous_id , new_builds_count
264
277
265
278
266
279
def build_spec_image_prefetch (builders_folder , different_build_specs ):
0 commit comments