#301 Add LIGHTBLUE_RELEASED_DEPENDENCIES_ONLY.
Merged 8 months ago by jkaluza. Opened 8 months ago by jkaluza.
jkaluza/freshmaker lb-release-deps-only  into  master

file modified
+8

@@ -262,6 +262,14 @@ 

              'type': str,

              'default': '',

              'desc': 'Path to LightBlue private key file.'},

+         'lightblue_released_dependencies_only': {

+             'type': bool,

+             'default': False,

+             'desc': 'When True, only released images will be used as dependencies '

+                     'for other images. WARN: This may lead to downgrade to older '

+                     'release as result of rebuild when image to rebuild depends '

+                     'on unreleased release of the parent image.'

+             },

          'errata_tool_server_url': {

              'type': str,

              'default': '',

file modified
+6 -1

@@ -1210,7 +1210,12 @@ 

              # in the `nvrs` list. Because `nvrs` list is desc sorted, every NVR

              # with higher index is lower and therefore we need to replace it.

              try:

-                 latest_released_nvr_index = nvrs.index(latest_released_nvr)

+                 if not conf.lightblue_released_dependencies_only:

+                     latest_released_nvr_index = nvrs.index(latest_released_nvr)

+                 else:

+                     # In case we want to use only released versions of images,

+                     # replace all the images with the latest released one.

+                     latest_released_nvr_index = -1

              except ValueError:

                  # In case the latest_released_nvr is not found in the nvrs,

                  # it means the all nvrs should be replaced by new one from

file modified
+49

@@ -1541,6 +1541,55 @@ 

          ret = self.lb._deduplicate_images_to_rebuild([httpd, perl, foo])

          self.assertEqual(ret, expected_images)

  

+     @patch.object(freshmaker.conf, 'lightblue_released_dependencies_only',

+                   new=True)

+     def test_use_highest_latest_released_nvr_include_released_only(self):

+         httpd = self._create_imgs([

+             "httpd-2.4-12",

+             "s2i-base-1-10",

+             "s2i-core-1-11",

+             "rhel-server-docker-7.4-125",

+         ])

+ 

+         perl = self._create_imgs([

+             "perl-5.7-1",

+             ["s2i-base-1-2", {"latest_released": True}],

+             "s2i-core-1-2",

+             "rhel-server-docker-7.4-150",

+         ])

+ 

+         foo = self._create_imgs([

+             "foo-5.7-1",

+             "s2i-base-1-1",

+             "s2i-core-1-2",

+             "rhel-server-docker-7.4-150",

+         ])

+ 

+         expected_images = [

+             self._create_imgs([

+                 "httpd-2.4-12",

+                 ["s2i-base-1-2", {"latest_released": True}],

+                 "s2i-core-1-11",

+                 "rhel-server-docker-7.4-150",

+             ]),

+             self._create_imgs([

+                 "perl-5.7-1",

+                 ["s2i-base-1-2", {"latest_released": True}],

+                 "s2i-core-1-11",

+                 "rhel-server-docker-7.4-150",

+             ]),

+             self._create_imgs([

+                 "foo-5.7-1",

+                 ["s2i-base-1-2", {"latest_released": True}],

+                 "s2i-core-1-11",

+                 "rhel-server-docker-7.4-150",

+             ])

+         ]

+ 

+         self.maxDiff = None
cqi commented 8 months ago

Is this required?

+         ret = self.lb._deduplicate_images_to_rebuild([httpd, perl, foo])

+         self.assertEqual(ret, expected_images)

+ 

      def test_use_highest_nvr(self):

          httpd = self._create_imgs([

              "httpd-2.4-12",

When True, only released images will be used as dependencies for other images. WARN: This may lead to downgrade to older release as result of rebuild when image to rebuild depends on unreleased release of the parent image.

Pull-Request has been merged by jkaluza

8 months ago