build policy

New 'build' policy replacing 'build_from_srpm' and 'build_from_repo_id'.

Related: https://pagure.io/koji/issue/3323

Author:    Tomas Kopecek <tkopecek@redhat.com>
This commit is contained in:
Tomas Kopecek 2022-06-21 15:43:20 +02:00
parent 07536056e8
commit e9ebe2250d
3 changed files with 13 additions and 2 deletions

View file

@ -1032,17 +1032,22 @@ class BuildTask(BaseTaskHandler):
'task_id': self.id,
'build_tag': build_tag, # id
'skip_tag': bool(self.opts.get('skip_tag')),
'scratch': opts.get('scratch'),
'from_scm': SCM.is_scm_url(src),
'repo_id': opts.get('repo_id'),
}
if target_info:
policy_data['target'] = target_info['name']
if not self.opts.get('skip_tag'):
policy_data['tag'] = dest_tag # id
# backward-compatible deprecated policies (TODO: remove in 1.33)
if not SCM.is_scm_url(src) and not opts.get('scratch'):
# let hub policy decide
self.session.host.assertPolicy('build_from_srpm', policy_data)
if opts.get('repo_id') is not None:
# use of this option is governed by policy
self.session.host.assertPolicy('build_from_repo_id', policy_data)
self.session.host.assertPolicy('build_rpm', policy_data)
if not repo_info:
repo_info = self.getRepo(build_tag, builds=opts.get('wait_builds'),
wait=opts.get('wait_repo')) # (subtask)