@@ -203,12 +203,6 @@ def trial_build_main(args=None, local_base_build=True):
203203 """Main function for trial_build."""
204204 args = get_args (args )
205205
206- test_image_tag = TEST_IMAGE_SUFFIX
207- if args .version_tag :
208- test_image_tag = f'{ test_image_tag } -{ args .version_tag } '
209- if args .branch :
210- test_image_tag = f'{ test_image_tag } -{ args .branch .lower ().replace ("/" , "-" )} '
211-
212206 if not args .skip_build_images :
213207 logging .info ('Starting "Build and Push Images" phase...' )
214208
@@ -246,10 +240,38 @@ def trial_build_main(args=None, local_base_build=True):
246240
247241 timeout = int (os .environ .get ('TIMEOUT' , SCRIPT_DEFAULT_TIMEOUT ))
248242 end_time = datetime .datetime .now () + datetime .timedelta (seconds = timeout )
249- return _do_test_builds (args , test_image_tag , end_time )
243+
244+ if local_base_build and not args .version_tag :
245+ versions_to_build = build_and_push_test_images .BASE_IMAGE_VERSIONS
246+ if not versions_to_build :
247+ return False
248+
249+ overall_result = True
250+ for version in versions_to_build :
251+ logging .info (
252+ '================================================================' )
253+ logging .info (' RUNNING TEST BUILDS FOR VERSION: %s' , version .upper ())
254+ logging .info (
255+ '================================================================' )
256+ test_image_tag = f'{ TEST_IMAGE_SUFFIX } -{ version } '
257+ if args .branch :
258+ test_image_tag = (
259+ f'{ test_image_tag } -{ args .branch .lower ().replace ("/" , "-" )} ' )
260+
261+ result = _do_test_builds (args , test_image_tag , end_time , version )
262+ overall_result = overall_result and result
263+ return overall_result
264+
265+ # GCB or local single-version case
266+ test_image_tag = TEST_IMAGE_SUFFIX
267+ if args .version_tag :
268+ test_image_tag = f'{ test_image_tag } -{ args .version_tag } '
269+ if args .branch :
270+ test_image_tag = f'{ test_image_tag } -{ args .branch .lower ().replace ("/" , "-" )} '
271+ return _do_test_builds (args , test_image_tag , end_time , args .version_tag )
250272
251273
252- def _do_test_builds (args , test_image_suffix , end_time ):
274+ def _do_test_builds (args , test_image_suffix , end_time , version_tag ):
253275 """Does test coverage and fuzzing builds."""
254276 build_types = []
255277 sanitizers = list (args .sanitizers )
@@ -336,7 +358,7 @@ def _do_test_builds(args, test_image_suffix, end_time):
336358 logging .info ('-----------------------' )
337359
338360 wait_result = wait_on_builds (build_ids , credentials , build_lib .IMAGE_PROJECT ,
339- end_time , skipped_projects , args . version_tag )
361+ end_time , skipped_projects , version_tag )
340362
341363 if failed_to_start_builds :
342364 logging .error (
0 commit comments