kiwibuild: allow setting description scm and path at phase level

Neal wanted this to work - he tried using global_description_scm
and global_description_path in the initial PR - but it wasn't
wired up to work. This should make it possible to set
`kiwibuild_description_scm` and `kiwibuild_description_path`.
It also technically lets you set `global_` for both, since the
`get_config` implementation is very generic, but it doesn't add
it to the checks, so you'd still get an "unrecognized config
option" warning, I think. It seems appropriate to encourage
setting this as a phase-level option rather than a global one
since it seems quite specific to the kiwibuild phase.

Merges: https://pagure.io/pungi/pull-request/1737
Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2024-03-07 14:05:52 -08:00 committed by Lubomír Sedlář
parent 0d310fb3b3
commit e90ffdfd93
2 changed files with 22 additions and 22 deletions

View File

@ -1238,8 +1238,10 @@ def make_schema():
"subvariant": {"type": "string"}, "subvariant": {"type": "string"},
}, },
"required": [ "required": [
"description_scm", # description_scm and description_path
"description_path", # are really required, but as they can
# be set at the phase level we cannot
# enforce that here
"kiwi_profile", "kiwi_profile",
], ],
"additionalProperties": False, "additionalProperties": False,
@ -1248,6 +1250,8 @@ def make_schema():
}, },
"additionalProperties": False, "additionalProperties": False,
}, },
"kiwibuild_description_scm": {"type": "url"},
"kiwibuild_description_path": {"type": "string"},
"kiwibuild_target": {"type": "string"}, "kiwibuild_target": {"type": "string"},
"kiwibuild_release": {"$ref": "#/definitions/optional_string"}, "kiwibuild_release": {"$ref": "#/definitions/optional_string"},
"kiwibuild_version": {"type": "string"}, "kiwibuild_version": {"type": "string"},

View File

@ -79,8 +79,14 @@ class KiwiBuildPhase(
self.log_debug("skip: no arches") self.log_debug("skip: no arches")
continue continue
release = self.get_release(image_conf) # these properties can be set per-image *or* as e.g.
target = self.get_config(image_conf, "target") # kiwibuild_description_scm or global_release in the config
generics = {
"release": self.get_release(image_conf),
"target": self.get_config(image_conf, "target"),
"descscm": self.get_config(image_conf, "description_scm"),
"descpath": self.get_config(image_conf, "description_path"),
}
repo = self._get_repo(image_conf, variant) repo = self._get_repo(image_conf, variant)
@ -95,8 +101,7 @@ class KiwiBuildPhase(
variant, variant,
image_conf, image_conf,
build_arches, build_arches,
release, generics,
target,
repo, repo,
failable_arches, failable_arches,
) )
@ -107,16 +112,7 @@ class KiwiBuildPhase(
class RunKiwiBuildThread(WorkerThread): class RunKiwiBuildThread(WorkerThread):
def process(self, item, num): def process(self, item, num):
( (compose, variant, config, arches, generics, repo, failable_arches) = item
compose,
variant,
config,
arches,
release,
target,
repo,
failable_arches,
) = item
self.failable_arches = failable_arches self.failable_arches = failable_arches
# the Koji task as a whole can only fail if *all* arches are failable # the Koji task as a whole can only fail if *all* arches are failable
can_task_fail = set(failable_arches).issuperset(set(arches)) can_task_fail = set(failable_arches).issuperset(set(arches))
@ -129,21 +125,21 @@ class RunKiwiBuildThread(WorkerThread):
"kiwibuild", "kiwibuild",
logger=self.pool._logger, logger=self.pool._logger,
): ):
self.worker(compose, variant, config, arches, release, target, repo) self.worker(compose, variant, config, arches, generics, repo)
def worker(self, compose, variant, config, arches, release, target, repo): def worker(self, compose, variant, config, arches, generics, repo):
msg = "kiwibuild task for variant %s" % variant.uid msg = "kiwibuild task for variant %s" % variant.uid
self.pool.log_info("[BEGIN] %s" % msg) self.pool.log_info("[BEGIN] %s" % msg)
koji = kojiwrapper.KojiWrapper(compose) koji = kojiwrapper.KojiWrapper(compose)
koji.login() koji.login()
task_id = koji.koji_proxy.kiwiBuild( task_id = koji.koji_proxy.kiwiBuild(
target, generics["target"],
arches, arches,
config["description_scm"], generics["descscm"],
config["description_path"], generics["descpath"],
profile=config["kiwi_profile"], profile=config["kiwi_profile"],
release=release, release=generics["release"],
repos=repo, repos=repo,
# this ensures the task won't fail if only failable arches fail # this ensures the task won't fail if only failable arches fail
optional_arches=self.failable_arches, optional_arches=self.failable_arches,