diff --git a/ansible_builder/user_definition.py b/ansible_builder/user_definition.py index 0ccf0818..63633920 100644 --- a/ansible_builder/user_definition.py +++ b/ansible_builder/user_definition.py @@ -229,15 +229,12 @@ def validate(self): images = self.raw.get('images', {}) if images: self.base_image = ImageDescription(images, 'base_image') - if images.get('builder_image'): - self.builder_image = ImageDescription(images, 'builder_image') - self.build_arg_defaults['EE_BUILDER_IMAGE'] = self.builder_image.name + self.builder_image = ImageDescription(images, 'builder_image') # Must set these values so that Containerfile uses the proper images - self.build_arg_defaults['EE_BASE_IMAGE'] = self.base_image.name - if self.builder_image: + if self.base_image.name: + self.build_arg_defaults['EE_BASE_IMAGE'] = self.base_image.name + if self.builder_image.name: self.build_arg_defaults['EE_BUILDER_IMAGE'] = self.builder_image.name - else: - self.build_arg_defaults['EE_BUILDER_IMAGE'] = None self._validate_additional_build_files() diff --git a/test/integration/test_create.py b/test/integration/test_create.py index 56c9f107..2a315a20 100644 --- a/test/integration/test_create.py +++ b/test/integration/test_create.py @@ -148,8 +148,8 @@ def test_v2_default_images(cli, build_dir_and_ee_yml): assert containerfile.exists() text = containerfile.read_text() - assert "ARG EE_BASE_IMAGE=quay.io/ansible/ansible-runner:latest" in text - assert "ARG EE_BUILDER_IMAGE=quay.io/ansible/ansible-builder:latest" in text + assert 'ARG EE_BASE_IMAGE="quay.io/ansible/ansible-runner:latest"' in text + assert 'ARG EE_BUILDER_IMAGE="quay.io/ansible/ansible-builder:latest"' in text def test_v2_default_base_image(cli, build_dir_and_ee_yml): @@ -170,8 +170,8 @@ def test_v2_default_base_image(cli, build_dir_and_ee_yml): assert containerfile.exists() text = containerfile.read_text() - assert "ARG EE_BASE_IMAGE=quay.io/ansible/ansible-runner:latest" in text - assert "ARG EE_BUILDER_IMAGE=quay.io/ansible/awx-ee:latest" in text + assert 'ARG EE_BASE_IMAGE="quay.io/ansible/ansible-runner:latest"' in text + assert 'ARG EE_BUILDER_IMAGE="quay.io/ansible/awx-ee:latest"' in text def test_v2_default_builder_image(cli, build_dir_and_ee_yml): @@ -192,8 +192,8 @@ def test_v2_default_builder_image(cli, build_dir_and_ee_yml): assert containerfile.exists() text = containerfile.read_text() - assert "ARG EE_BASE_IMAGE=quay.io/ansible/awx-ee:latest" in text - assert "ARG EE_BUILDER_IMAGE=quay.io/ansible/ansible-builder:latest" in text + assert 'ARG EE_BASE_IMAGE="quay.io/ansible/awx-ee:latest"' in text + assert 'ARG EE_BUILDER_IMAGE="quay.io/ansible/ansible-builder:latest"' in text def test_pre_post_commands(cli, data_dir, tmp_path):