make newRepo for sidetag configurable

This commit is contained in:
Tomas Kopecek 2023-06-09 10:55:44 +02:00
parent fdedf0936a
commit f6d67d8478
3 changed files with 24 additions and 8 deletions

View file

@ -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

View file

@ -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")