Skip to content

Commit

Permalink
Accept repo URLs in CLI and pass it in builder plugin to osbs
Browse files Browse the repository at this point in the history
  • Loading branch information
pbabinca committed Jun 30, 2015
1 parent dbc32e4 commit 92088ee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
6 changes: 5 additions & 1 deletion koji_containerbuild/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ def handle_container_build(options, session, args):
parser.add_option("--epoch",
help=_("Specify container epoch. Requires koji admin "
"permission."))
parser.add_option("--repo-url", dest='yum_repourls', metavar="REPO_URL",
action='append',
help=_("URL of yum repo file. May be used multiple "
"times."))
(build_opts, args) = parser.parse_args(args)
if len(args) != 2:
parser.error(_("Exactly two arguments (a build target and a SCM URL "
Expand All @@ -76,7 +80,7 @@ def handle_container_build(options, session, args):
parser.error(_("Destination tag %s is locked" % dest_tag['name']))
source = args[1]
opts = {}
for key in ('scratch', 'epoch'):
for key in ('scratch', 'epoch', 'yum_repourls'):
val = getattr(build_opts, key)
if val is not None:
opts[key] = val
Expand Down
15 changes: 11 additions & 4 deletions koji_containerbuild/plugins/builder_containerbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ def _rpm_package_info(self, parts):
rpm['epoch'] = int(parts[4])
return rpm

def handler(self, src, target_info, arch, output_template, scratch=False):
def handler(self, src, target_info, arch, output_template, scratch=False,
yum_repourls=None):
if not yum_repourls:
yum_repourls = []

this_task = self.session.getTaskInfo(self.id)
self.logger.debug("This task: %r", this_task)
owner_info = self.session.getUser(this_task['owner'])
Expand All @@ -203,6 +207,7 @@ def handler(self, src, target_info, arch, output_template, scratch=False):
component=component,
target=target_info['name'],
architecture=arch,
yum_repourls=yum_repourls,
)
build_id = build_response.build_id
self.logger.debug("OSBS build id: %r", build_id)
Expand Down Expand Up @@ -306,15 +311,16 @@ def check_whitelist(self, name, target_info):
raise koji.BuildError("package (container) %s is blocked for tag %s" % (name, target_info['dest_tag_name']))

def runBuilds(self, src, target_info, arches, output_template,
scratch=False):
scratch=False, yum_repourls=None):
subtasks = {}
for arch in arches:
subtasks[arch] = self.session.host.subtask(method='createContainer',
arglist=[src,
target_info,
arch,
output_template,
scratch],
scratch,
yum_repourls],
label='container',
parent=self.id)
self.logger.debug("Got image subtasks: %r", (subtasks))
Expand Down Expand Up @@ -458,7 +464,8 @@ def handler(self, src, target, opts=None):
output_template = self._getOutputImageTemplate(**data)
results = self.runBuilds(src, target_info, archlist,
output_template,
opts.get('scratch', False))
opts.get('scratch', False),
opts.get('yum_repourls', None))
results_xmlrpc = {}
for task_id, result in results.items():
# get around an xmlrpc limitation, use arches for keys instead
Expand Down

0 comments on commit 92088ee

Please sign in to comment.