make newRepo for sidetag configurable
This commit is contained in:
parent
fdedf0936a
commit
f6d67d8478
3 changed files with 24 additions and 8 deletions
|
|
@ -9,7 +9,8 @@ from optparse import OptionParser
|
|||
|
||||
import koji
|
||||
from koji.plugin import export_cli
|
||||
from koji_cli.lib import activate_session, arg_filter, watch_tasks
|
||||
from koji_cli.commands import anon_handle_wait_repo
|
||||
from koji_cli.lib import activate_session, arg_filter
|
||||
|
||||
|
||||
@export_cli
|
||||
|
|
@ -37,7 +38,7 @@ def handle_add_sidetag(options, session, args):
|
|||
if opts.suffix:
|
||||
kwargs['suffix'] = opts.suffix
|
||||
try:
|
||||
info = session.createSideTag(basetag, **kwargs)
|
||||
tag = session.createSideTag(basetag, **kwargs)
|
||||
except koji.ActionNotAllowed:
|
||||
parser.error("Policy violation")
|
||||
except koji.ParameterError as ex:
|
||||
|
|
@ -47,11 +48,13 @@ def handle_add_sidetag(options, session, args):
|
|||
raise
|
||||
|
||||
if not opts.quiet:
|
||||
print(info["name"])
|
||||
print(tag["name"])
|
||||
|
||||
if opts.wait:
|
||||
return watch_tasks(session, [info['task_id']], quiet=opts.quiet,
|
||||
poll_interval=options.poll_interval, topurl=options.topurl)
|
||||
args = ["--target", tag["name"]]
|
||||
if opts.quiet:
|
||||
args.append("--quiet")
|
||||
anon_handle_wait_repo(options, session, args)
|
||||
|
||||
|
||||
@export_cli
|
||||
|
|
|
|||
|
|
@ -1,9 +1,15 @@
|
|||
[sidetag]
|
||||
# automatically remove sidetag on untagging last package
|
||||
remove_empty = off
|
||||
|
||||
# potential suffixes for sidetag names
|
||||
# allowed_suffixes =
|
||||
|
||||
# template for sidetag names. It must contain basetag and tag_id parts
|
||||
# if allowed_suffixes is not empty and suffix was requested, it will be added
|
||||
# as {name_template}-{suffix}. (percent-signs need to be escaped)
|
||||
# name_template = {basetag}-side-{tag_id}
|
||||
|
||||
# Automaticaly trigger newRepo task for every new sidetag. Otherwise let kojira
|
||||
# prioritize these.
|
||||
# trigger_new_repo = False
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ from kojihub.db import QueryProcessor, nextval
|
|||
CONFIG_FILE = "/etc/koji-hub/plugins/sidetag.conf"
|
||||
CONFIG = None
|
||||
ALLOWED_SUFFIXES = []
|
||||
TRIGGER_NEW_REPO = False
|
||||
|
||||
|
||||
def is_sidetag(taginfo, raise_error=False):
|
||||
|
|
@ -136,9 +137,13 @@ def createSideTag(basetag, debuginfo=False, suffix=None):
|
|||
)
|
||||
_create_build_target(sidetag_name, sidetag_id, sidetag_id)
|
||||
|
||||
# little higher priority than other newRepo tasks
|
||||
args = koji.encode_args(sidetag_name, debuginfo=debuginfo)
|
||||
task_id = make_task('newRepo', args, priority=14, channel='createrepo')
|
||||
|
||||
if TRIGGER_NEW_REPO:
|
||||
# little higher priority than other newRepo tasks
|
||||
args = koji.encode_args(sidetag_name, debuginfo=debuginfo)
|
||||
task_id = make_task('newRepo', args, priority=14, channel='createrepo')
|
||||
else:
|
||||
task_id = None
|
||||
|
||||
return {"name": sidetag_name, "id": sidetag_id, 'task_id': task_id}
|
||||
|
||||
|
|
@ -367,3 +372,5 @@ if not CONFIG:
|
|||
NAME_TEMPLATE = CONFIG.get("sidetag", "name_template")
|
||||
else:
|
||||
NAME_TEMPLATE = '{basetag}-side-{tag_id}'
|
||||
if CONFIG.has_option("sidetag", "trigger_new_repo"):
|
||||
TRIGGER_NEW_REPO = CONFIG.getboolean("sidetag", "trigger_new_repo")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue