PR#3841: create initial repo for sidetag
Merges #3841 https://pagure.io/koji/pull-request/3841 Fixes: #3808 https://pagure.io/koji/issue/3808 RFE: Copy/link/use the initial side tag repo from parent (to avoid worflow delays)
This commit is contained in:
commit
369e816bcf
3 changed files with 20 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -18,15 +18,16 @@ from kojihub import (
|
|||
get_build_target,
|
||||
get_tag,
|
||||
get_user,
|
||||
make_task,
|
||||
policy_get_user,
|
||||
readInheritanceData,
|
||||
)
|
||||
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,7 +137,14 @@ def createSideTag(basetag, debuginfo=False, suffix=None):
|
|||
)
|
||||
_create_build_target(sidetag_name, sidetag_id, sidetag_id)
|
||||
|
||||
return {"name": sidetag_name, "id": sidetag_id}
|
||||
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}
|
||||
|
||||
|
||||
@export
|
||||
|
|
@ -363,3 +371,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")
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class TestCreateSideTagHub(unittest.TestCase):
|
|||
self._create_tag.return_value = 12346
|
||||
|
||||
ret = sidetag_hub.createSideTag('base_tag')
|
||||
self.assertEqual(ret, {'name': sidetag_name, 'id': 12346})
|
||||
self.assertEqual(ret, {'name': sidetag_name, 'id': 12346, 'task_id': None})
|
||||
|
||||
self.get_user.assert_called_once_with(23, strict=True)
|
||||
self.get_tag.assert_called_once_with(self.basetag['name'], strict=True)
|
||||
|
|
@ -83,7 +83,7 @@ class TestCreateSideTagHub(unittest.TestCase):
|
|||
sidetag_hub.NAME_TEMPLATE = '{basetag}-sidetag-{tag_id}'
|
||||
|
||||
ret = sidetag_hub.createSideTag('base_tag', debuginfo=True, suffix='suffix')
|
||||
self.assertEqual(ret, {'name': sidetag_name, 'id': 12346})
|
||||
self.assertEqual(ret, {'name': sidetag_name, 'id': 12346, 'task_id': None})
|
||||
|
||||
def test_createsidetag_template_forbidden_suffix(self):
|
||||
sidetag_hub.ALLOWED_SUFFIXES = ['suffix', 'another']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue