#1733 Phases/osbuild: support passing 'customizations' for image builds
Merged a year ago by lsedlar. Opened a year ago by thozza.

file modified
+4
@@ -1659,6 +1659,10 @@ 

      * ``ostree_ref`` -- name of the ostree branch

      * ``ostree_parent`` -- commit hash or a a branch-like reference to the

        parent commit.

+     * ``customizations`` -- a dictionary with customizations to use for the

+       image build. For the list of supported customizations, see the **hosted**

+       variants in the `Image Builder documentation

+       <https://osbuild.org/docs/user-guide/blueprint-reference#installation-device>`.

      * ``upload_options`` -- a dictionary with upload options specific to the

        target cloud environment. If provided, the image will be uploaded to the

        cloud environment, in addition to the Koji server. One can't combine

file modified
+4
@@ -1277,6 +1277,10 @@ 

                                  "ostree_ref": {"type": "string"},

                                  "ostree_parent": {"type": "string"},

                                  "manifest_type": {"type": "string"},

+                                 "customizations": {

+                                     "type": "object",

+                                     "additionalProperties": True,

+                                 },

                                  "upload_options": {

                                      # this should be really 'oneOf', but the minimal

                                      # required properties in AWSEC2 and GCP options

file modified
+4
@@ -159,6 +159,10 @@ 

          if upload_options:

              opts["upload_options"] = upload_options

  

+         customizations = config.get("customizations")

+         if customizations:

+             opts["customizations"] = customizations

+ 

          if release:

              opts["release"] = release

          task_id = koji.koji_proxy.osbuildImage(

@@ -190,6 +190,53 @@ 

          self.assertNotEqual(validate(compose.conf), ([], []))

  

      @mock.patch("pungi.phases.osbuild.ThreadPool")

+     def test_run_with_customizations(self, ThreadPool):

+         cfg = {

+             "name": "test-image",

+             "distro": "rhel-8",

+             "image_types": ["qcow2"],

+             "customizations": {

+                 "installation_device": "/dev/sda"

+             }

+         }

+         compose = helpers.DummyCompose(

+             self.topdir,

+             {

+                 "osbuild": {"^Everything$": [cfg]},

+                 "osbuild_target": "image-target",

+                 "osbuild_version": "1",

+                 "osbuild_release": "2",

+             },

+         )

+ 

+         self.assertValidConfig(compose.conf)

+ 

+         pool = ThreadPool.return_value

+ 

+         phase = osbuild.OSBuildPhase(compose)

+         phase.run()

+ 

+         self.assertEqual(len(pool.add.call_args_list), 1)

+         self.assertEqual(

+             pool.queue_put.call_args_list,

+             [

+                 mock.call(

+                     (

+                         compose,

+                         compose.variants["Everything"],

+                         cfg,

+                         sorted(compose.variants["Everything"].arches),

+                         "1",

+                         "2",

+                         "image-target",

+                         [self.topdir + "/compose/Everything/$arch/os"],

+                         [],

+                     ),

+                 ),

+             ],

+         )

+ 

+     @mock.patch("pungi.phases.osbuild.ThreadPool")

      def test_rich_repos(self, ThreadPool):

          repo = {"baseurl": "http://example.com/repo", "package_sets": ["build"]}

          cfg = {

The osbuild Koji plugin supports passing customizations for an image
build. This is also supported in the Koji CLI plugin. Some teams want to
pass image customizations for images built as part of Pungi composes.
Extend the osbuild phase to support passing customizations in the Pungi
configuration.

Signed-off-by: Tomáš Hozza thozza@redhat.com

Commit e738f65 fixes this pull-request

Pull-Request has been merged by lsedlar

a year ago

Thank you for the patch. Looks good to me. I'll merge it with a small tweak to formatting to make Jenkins happy.

That works for the IoT compose with simplified provisioning :thumbsup: