plugin hooks for repo modification

Fixes: https://pagure.io/koji/issue/2636
This commit is contained in:
Tomas Kopecek 2021-01-11 13:52:35 +01:00
parent 3e8f8000c8
commit 6ad2bccec3
3 changed files with 13 additions and 0 deletions

View file

@ -5458,6 +5458,10 @@ class CreaterepoTask(BaseTaskHandler):
with open(os.path.join(self.datadir, "EMPTY_REPO"), 'wt') as fo:
fo.write("This repo is empty because its tag has no content for this arch\n")
tag = self.session.getTag(rinfo['tag_id'], event=rinfo['create_event'], strict=True)['name']
self.run_callbacks('postCreateRepo', tag=tag, repodir=self.outdir,
repo_id=self.repo_id, arch=arch)
uploadpath = self.getUploadDir()
files = []
for f in os.listdir(self.datadir):
@ -5758,6 +5762,9 @@ class createDistRepoTask(BaseTaskHandler):
fp.write("This repo is empty because its tag has no content "
"for this arch\n")
self.run_callbacks('postCreateDistRepo', tag=tag, repodir=self.repodir,
repo_id=repo_id, arch=arch, keys=keys, opts=opts)
# upload repo files
self.upload_repo()
self.upload_repo_manifest()

View file

@ -216,6 +216,8 @@ builder:
- preSCMCheckout
- postSCMCheckout
- postCreateDistRepo
- postCreateRepo
.. _plugin-cli-command:

View file

@ -34,6 +34,7 @@ from koji.util import encode_datetime_recurse
# the available callback hooks and a list
# of functions to be called for each event
callbacks = {
# hub
'prePackageListChange': [],
'postPackageListChange': [],
'preTaskStateChange': [],
@ -54,8 +55,11 @@ callbacks = {
'postRepoDone': [],
'preCommit': [],
'postCommit': [],
# builder
'preSCMCheckout': [],
'postSCMCheckout': [],
'postCreateDistRepo': [],
'postCreateRepo': [],
}