Skip to content

Commit 1c7240d

Browse files
committed
feat(build): Add dynamic ubuntu_version tag to runner image
This change modifies the build process to support dynamic tagging of base runner images based on the specified in a project's . - The function now reads the . - If the version is 'legacy' or not specified, it defaults to , ensuring that existing projects continue to use the tag. - If a specific version like 'ubuntu-24-04' is provided, it is passed through the configuration and used to tag the runner image name. This fixes an issue where projects intended for Ubuntu 24.04 were incorrectly using the latest base image.
1 parent b89d883 commit 1c7240d

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

infra/build/functions/build_project.py

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -348,22 +348,15 @@ def get_id(step_type, build):
348348
f'-{build.architecture}')
349349

350350

351-
def get_build_steps( # pylint: disable=too-many-locals, too-many-statements, too-many-branches, too-many-arguments
352-
project_name,
353-
project_yaml,
354-
dockerfile,
355-
config,
356-
additional_env=None,
357-
use_caching=False,
358-
timestamp=None):
359-
"""Returns build steps for project."""
351+
def get_build_steps(project_name, project_yaml, dockerfile_contents, config):
352+
"""Returns the build steps for a project."""
360353

361-
project = Project(project_name, project_yaml, dockerfile)
354+
project = Project(project_name, project_yaml, dockerfile_contents)
362355
return get_build_steps_for_project(project,
363356
config,
364-
additional_env=additional_env,
365-
use_caching=use_caching,
366-
timestamp=timestamp), None
357+
additional_env=None,
358+
use_caching=False,
359+
timestamp=None), None
367360

368361

369362
def get_build_steps_for_project(project,
@@ -489,7 +482,8 @@ def get_build_steps_for_project(project,
489482
# Generate targets list.
490483
{
491484
'name':
492-
build_lib.get_runner_image_name(config.test_image_suffix, config.base_image_tag),
485+
build_lib.get_runner_image_name(config.test_image_suffix,
486+
config.base_image_tag),
493487
'env':
494488
env,
495489
'args': [
@@ -865,11 +859,13 @@ def build_script_main(script_description,
865859
error = True
866860
continue
867861

868-
ubuntu_version = project_yaml.get('ubuntu_version', 'legacy')
869-
config = create_config(args, build_type, base_image_tag=ubuntu_version)
862+
base_image_tag = project_yaml.get('ubuntu_version')
863+
if base_image_tag == 'legacy':
864+
base_image_tag = None
865+
config = create_config(args, build_type, base_image_tag=base_image_tag)
870866

871-
steps = get_build_steps_func(project_name, project_yaml,
872-
dockerfile_contents, config)
867+
steps, _ = get_build_steps_func(project_name, project_yaml,
868+
dockerfile_contents, config)
873869
if not steps:
874870
logging.error('No steps. Skipping %s.', project_name)
875871
error = True

0 commit comments

Comments
 (0)