Support specifying upload options for image builds

The upload options are expected to be provided as a JSON file. The same
options will be used for all image type and architecture combinations,
similarly as it is done for ostree options.

Extend unit tests to cover the newly added functionality.
This commit is contained in:
Tomas Hozza 2022-07-29 17:28:43 +02:00 committed by Ondřej Budai
parent 4e32ae5439
commit c76e97ddc9
4 changed files with 151 additions and 0 deletions

View file

@ -116,6 +116,7 @@ class ImageRequest:
self.image_type = image_type
self.repositories = repos
self.ostree: Optional[OSTreeOptions] = None
self.upload_options: Optional[Dict] = None
def as_dict(self):
arch = self.architecture
@ -128,6 +129,8 @@ class ImageRequest:
}
if self.ostree:
res["ostree"] = self.ostree.as_dict(self.architecture)
if self.upload_options:
res["upload_options"] = self.upload_options
return res
@ -688,6 +691,12 @@ class OSBuildImage(BaseTaskHandler):
for ireq in ireqs:
ireq.ostree = ostree
# Cloud upload options
upload_options = opts.get("upload_options")
if upload_options:
for ireq in ireqs:
ireq.upload_options = upload_options
self.logger.debug("Creating compose: %s (%s)\n koji: %s\n images: %s",
nvr, distro, self.koji_url,
str([i.as_dict() for i in ireqs]))