#3558 kiwi: propagate --type option
Merged a year ago by tkopecek. Opened 2 years ago by tkopecek.
tkopecek/koji issue3556  into  master

file modified
+5 -3
@@ -325,11 +325,11 @@ 

                                 'user_id': self.taskinfo['owner'],

                                 'channel': self.session.getChannel(self.taskinfo['channel_id'],

                                                                    strict=True)['name'],

-                                'scratch': self.opts.get('scratch')

+                                'scratch': self.opts.get('scratch', False)

                             })

          logfile = os.path.join(self.workdir, 'checkout-%s.log' % arch)

          self.run_callbacks('preSCMCheckout', scminfo=scm.get_info(),

-                            build_tag=build_tag, scratch=self.opts.get('scratch'))

+                            build_tag=build_tag, scratch=self.opts.get('scratch', False))

          scmdir = broot.tmpdir()

          koji.ensuredir(scmdir)

          scmsrcdir = scm.checkout(scmdir, self.session,
@@ -337,7 +337,7 @@ 

          self.run_callbacks("postSCMCheckout",

                             scminfo=scm.get_info(),

                             build_tag=build_tag,

-                            scratch=self.opts.get('scratch'),

+                            scratch=self.opts.get('scratch', False),

                             srcdir=scmsrcdir)

  

          # user repos
@@ -365,6 +365,8 @@ 

          cmd = ['kiwi-ng']

          if self.opts.get('profile'):

              cmd.extend(['--profile', self.opts['profile']])

+         if self.opts.get('type'):

+             cmd.extend(['--type', self.opts['type']])

          target_dir = '/builddir/result/image'

          cmd.extend([

              '--kiwi-file', os.path.basename(desc),  # global option for image/system commands

file modified
+24 -18
@@ -27,6 +27,7 @@ 

                        help="Do not display progress of the upload")

      parser.add_option("--kiwi-profile", action="store", default=None,

                        help="Select profile from description file")

+     parser.add_option("--type", help="Override default build type from description")

      parser.add_option("--make-prep", action="store_true", default=False,

                        help="Run 'make prep' in checkout before starting the build")

      parser.add_option("--can-fail", action="store", dest="optional_arches",
@@ -46,28 +47,33 @@ 

      target, scm, path = args

  

      activate_session(session, goptions)

- 

      kwargs = {

-         'scratch': options.scratch,

-         'optional_arches': [canonArch(arch)

-                             for arch in options.optional_arches.split(',')

-                             if arch],

-         'profile': options.kiwi_profile,

-         'release': options.release,

-         'make_prep': options.make_prep,

+         'arches': [],

+         'target': target,

+         'desc_url': scm,

+         'desc_path': path,

      }

- 

-     arches = []

+     if options.scratch:

+         kwargs['scratch'] = True

+     if options.optional_arches:

+         kwargs['optional_arches'] = [

+             canonArch(arch)

+             for arch in options.optional_arches.split(',')

+             if arch]

+     if options.kiwi_profile:

+         kwargs['profile'] = options.kiwi_profile

+     if options.release:

+         kwargs['release'] = options.release

+     if options.make_prep:

+         kwargs['make_prep'] = True

+     if options.type:

+         kwargs['type'] = options.type

      if options.arches:

-         arches = [canonArch(arch) for arch in options.arches]

+         kwargs['arches'] = [canonArch(arch) for arch in options.arches]

+     if options.repo:

+         kwargs['repos'] = options.repo

  

-     task_id = session.kiwiBuild(

-         target=target,

-         arches=arches,

-         desc_url=scm,

-         desc_path=path,

-         repos=options.repo,

-         **kwargs)

+     task_id = session.kiwiBuild(**kwargs)

  

      if not goptions.quiet:

          print("Created task: %d" % task_id)

file modified
+17 -9
@@ -16,7 +16,8 @@ 

  

  @export

  def kiwiBuild(target, arches, desc_url, desc_path, optional_arches=None, profile=None,

-               scratch=False, priority=None, make_prep=False, repos=None, release=None):

+               scratch=False, priority=None, make_prep=False, repos=None, release=None,

+               type=None):

      context.session.assertPerm('image')

      for i in [desc_url, desc_path, profile, release]:

          if i is not None:
@@ -42,14 +43,21 @@ 

                      'only admins may create high-priority tasks')

          taskOpts['priority'] = koji.PRIO_DEFAULT + priority

  

-     opts = {

-         'optional_arches': optional_arches,

-         'profile': profile,

-         'scratch': bool(scratch),

-         'release': release,

-         'repos': repos or [],

-         'make_prep': bool(make_prep),

-     }

+     opts = {}

+     if scratch:

+         opts['scratch'] = True

+     if profile:

+         opts['profile'] = profile

+     if release:

+         opts['release'] = release

+     if optional_arches:

+         opts['optional_arches'] = optional_arches

+     if repos:

+         opts['repos'] = repos

+     if make_prep:

+         opts['make_prep'] = True

+     if type:

+         opts['type'] = type

      return kojihub.make_task('kiwiBuild',

                               [target, arches, desc_url, desc_path, opts],

                               **taskOpts)

opts['type'] -> self.opts['type']?

rebased onto 5c4076a4d5a0d309bc364823caba624d69f40b97

2 years ago

rebased onto e6a9553

2 years ago

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

2 years ago

It seems to have broken things:

$> cbs kiwi-build --scratch hyperscale9s-spin_media-experimental-el9s git+https://gitlab.com/CentOS/Hyperscale/releng/kiwi-descriptions.git#f7475459b17b75adaf3b048bf4ec166830da3218 ./CentOS-Stream-Hyperscale-Spin.kiwi --kiwi-profile=OpenStack --arch=x86_64
2022-10-27 08:12:59,584 [ERROR] koji: ParameterError: Invalid type for value '['OpenStack']': <class 'list'>, expected type <class 'str'>

cc: @arrfab

It looks that hub part of plugin wasn't deployed?
It works for me locally. Anyway, this concrete build has two other problems:
1) repo https://cbs.centos.org/koji/taginfo?tagID=2665 doesn't have "core" group and is missing (at least) centos-release-hyperscale centos-release-hyperscale-experimental centos-release-hyperscale-spin packages. That's were it fails for me during task.
2) #3567 - it tries to run mknod for some /dev/ files which doesn't make sense in current implementation, so I've changed bind_opts to not bind local dev system.

2) #3567 - it tries to run mknod for some /dev/ files which doesn't make sense in current implementation, so I've changed bind_opts to not bind local dev system.

I'm not sure that would result in working image builds. Wouldn't that mean things like device-mapper and btrfs-control wouldn't be available?

The creation of nodes occurs in the chroot that kiwi creates, but it still needs /dev in the environment kiwi runs in.

remove trailing comma as it is the thing that breaks your stuff in other ticket (list/str conversion)

1 new commit added

  • fix additional commas
a year ago

Metadata Update from @jobrauer:
- Pull-request tagged with: testing-done

a year ago

Commit 25854a4 fixes this pull-request

Pull-Request has been merged by tkopecek

a year ago