From 54898e34f115a69dad13eb07415ba697e4798de0 Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Mon, 22 Aug 2022 10:46:26 +1200 Subject: [PATCH] Set working cs9 defaults for image build The current `openstack tripleo container image build` defaults result in a failed build for the following reasons: - The base image is ubi8 (rhel) - The default --distro is centos - tcib_release is a mandatory variable but is unset, resulting in a build failure This change does the following: - default --base is now centos:stream9 - new argument --release defaults to '9', which sets tcib_release This results in built cs9 container images without requiring any --base or --tcib-extras arguments. Change-Id: I69346aa10d734580ba66e0dd571a27e46e123fe8 --- .../test_tripleo_container_image.py | 4 ++-- tripleoclient/v2/tripleo_container_image.py | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/tripleoclient/tests/v2/container_image/test_tripleo_container_image.py b/tripleoclient/tests/v2/container_image/test_tripleo_container_image.py index 707cdfd64..0bfccd071 100644 --- a/tripleoclient/tests/v2/container_image/test_tripleo_container_image.py +++ b/tripleoclient/tests/v2/container_image/test_tripleo_container_image.py @@ -269,8 +269,8 @@ class TestContainerImages(deploy_fakes.TestDeployOvercloud): mock_find_image.return_value = rtn_value cfgs = self.cmd.process_images(expected_images, parsed_args, image_configs) - mock_find_image.assert_called_once_with(self.cmd, 'foo', - '/foo/tcib', 'ubi8') + mock_find_image.assert_called_once_with( + self.cmd, 'foo', '/foo/tcib', 'centos:stream9') self.assertEqual(cfgs, {'foo': rtn_value}) diff --git a/tripleoclient/v2/tripleo_container_image.py b/tripleoclient/v2/tripleo_container_image.py index 4069ca2a0..a6ee06e21 100644 --- a/tripleoclient/v2/tripleo_container_image.py +++ b/tripleoclient/v2/tripleo_container_image.py @@ -69,7 +69,7 @@ class Build(command.Command): "--base", dest="base", metavar="", - default="ubi8", + default="centos:stream9", help=_( "Base image name, with optional version. Can be 'centos:8', " "base name image will be 'centos' but 'centos:8' will be " @@ -105,8 +105,19 @@ class Build(command.Command): default="centos", metavar="", help=_( - "Distro name, if undefined the system will build using the " - "host distro. (default: %(default)s)" + "Distro name which sets tcib_distro, if undefined the " + "system will build using the host distro. " + "(default: %(default)s)" + ), + ) + parser.add_argument( + "--release", + dest="release", + default="9", + metavar="", + help=_( + "Distro major release version which sets tcib_release. " + "(default: %(default)s)" ), ) parser.add_argument( @@ -577,6 +588,7 @@ class Build(command.Command): { "workdir": self.image_paths.get(image, work_dir), "tcib_distro": parsed_args.distro, + "tcib_release": parsed_args.release, "tcib_path": self.image_paths.get(image, work_dir), "tcib_meta": {"name": image_parsed_name}, "ansible_connection": "local",