Skip to content

Commit

Permalink
Carry over fix for v2 default images
Browse files Browse the repository at this point in the history
  • Loading branch information
Shrews committed Mar 23, 2023
1 parent 8334ded commit 5dcc709
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
11 changes: 4 additions & 7 deletions ansible_builder/user_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
12 changes: 6 additions & 6 deletions test/integration/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand Down

0 comments on commit 5dcc709

Please sign in to comment.