#84 [Feature Request] Allow koji-builder to use Mock's sign plugin to automatically sign package after build
Closed: Fixed by mikem. Opened by amessina.

The attached patch allows koji-builder to use Mock's sign plugin to automatically sign package after building. I am using this patch on my private Koji instance. As a proof-of-concept it works, but perhaps a better method would be to let Koji pull down tag_extra information and auto-parse the options so each option wouldn't need to be passed between kojid and Koji's __init__.py manually.
koji-builder-enable-mock-sign-plugin.patch


The above patch works with the following Koji tag_extra configuration:

koji edit-tag -x mock.plugin_conf.sign_enable=True f23-build
koji edit-tag -x mock.plugin_conf.sign_opts.cmd="rpmsign" f23-build
koji edit-tag -x mock.plugin_conf.sign_opts.opts="--addsign %(rpms)s -D '%%_gpg_name XXXXXXXX' -D '%%_gpg_path /etc/mock/gnupg-sign'" f23-build

Can you upload patch once more? It is no more downloadable here.

Tomas help check the patch and ask auther uploa

Metadata Update from @yulwang:
- Issue priority set to: Low
- Issue tagged with: groomed

Re-attached original patch.

koji-builder-enable-mock-sign-plugin.patch

@tkopecek please take a look

Metadata Update from @dgregor:
- Custom field Size adjusted to None

Converted to PR and rewritten some logic, so we can use it later for other plugins: #1932

Metadata Update from @tkopecek:
- Issue set to the milestone: 1.22

Metadata Update from @jcupova:
- Issue tagged with: testing-ready

Metadata Update from @mfilip:
- Issue tagged with: testing-done

Commit 62998b08 fixes this issue

Commit 477fb48b fixes this issue

The merge didn't contain the fix from the comment on the pull request--the following is an incorrect check:

# check rest of configuration            
if 'mock.plugin_conf.sign_cmd' not in self.config['extra'] or \            
    'mock.plugin_conf.sign_opts' not in self.config['extra']:

It needs:

# check rest of configuration
if ('mock.plugin_conf.sign_opts.cmd' not in self.config['extra'] or
    'mock.plugin_conf.sign_opts.opts' not in self.config['extra']):

Metadata Update from @amessina:
- Issue status updated to: Open (was: Closed)

@amessina Why do you think it is needed? I've simplified koji options, so it is using mock.plugin_conf.sign_cmd and mock.plugin_conf.sign_opts for what is in mock stored under mock.plugin_conf.sign_opts.* Is it not working?

@tkopecek because mock.plugin_conf.sign_cmd != mock.plugin_conf.sign_opts.cmd. There is no mock.plugin_conf.sign_cmd. From the mock site-defaults.cfg:

# Configuration options for the sign plugin:
# config_opts['plugin_conf']['sign_enable'] = False
# config_opts['plugin_conf']['sign_opts'] = {}
# config_opts['plugin_conf']['sign_opts']['cmd'] = 'rpmsign'
# The options to pass to the signing command. %(rpms)s will be expanded to
# the rpms in the results folder.
# config_opts['plugin_conf']['sign_opts']['opts'] = '--addsign %(rpms)s -D "%%_gpg_name your_name" -D "%%_gpg_path /home/your_name/.gnupg"'

So, you just want 1:1 "visual" compatibility with mock? As on code-level it is doing exactly this.

+                     'cmd': self.config['extra']['mock.plugin_conf.sign_opts.cmd'],
+                     'opts': self.config['extra']['mock.plugin_conf.sign_opts.opts'],

I think this is wrong. it should be mock.plugin_conf.sign_cmd and sign_opts.

@tkopecek, @ignatenkobrain I only mentioned having the code reflect what mock expects as this is really a mock feature that koji makes use of rather than a native koji feature. My thought was that people would be introduced to this functionality through mock's site-default.cfg which documents the variables and expect to configure koji in the same way.

My extra options for the f32-build tag can be seen here: https://messinet.com/koji/taginfo?tagID=136 (currently manually patching in this functionality).

I'm happy to change those when the next release with your fix is out, I just wasn't perceiving real value in having the variables be slightly different from what would exist in site-defaults.cfg

Ok, it is valid - I'll change it.

PR #2337

Metadata Update from @tkopecek:
- Issue untagged with: testing-done

Metadata Update from @mfilip:
- Issue tagged with: testing-done

Commit 63834751 fixes this issue

Commit f8b26a1b relates to this ticket

This issue has been migrated to Fedora Forge:
https://forge.fedoraproject.org/koji/koji/issues/84

Please continue any further discussion there.

Metadata
Related Pull Requests