mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
pipeline: correctly quote params passed over pure strings (eg in the GHA JSON matrixes) so values with spaces are not mangled
This commit is contained in:
committed by
igorpecovnik
parent
1b36bb63d7
commit
de8bbcec11
@@ -205,10 +205,12 @@ def armbian_get_all_boards_inventory():
|
||||
return info_for_board
|
||||
|
||||
|
||||
def map_to_armbian_params(map_params):
|
||||
def map_to_armbian_params(map_params, quote_params=False) -> list[str]:
|
||||
ret = []
|
||||
for param in map_params:
|
||||
ret.append(param + "=" + map_params[param])
|
||||
if quote_params:
|
||||
ret = ["'" + param + "'" for param in ret] # single-quote each param...
|
||||
return ret
|
||||
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ def generate_matrix_images(info) -> list[dict]:
|
||||
image_arch = image['out']['ARCH']
|
||||
runs_on = resolve_gha_runner_tags_via_pipeline_gha_config(inputs, "image", image_arch)
|
||||
|
||||
cmds = (armbian_utils.map_to_armbian_params(inputs["vars"]) + inputs["configs"]) # image build is "build" command, omitted here
|
||||
cmds = (armbian_utils.map_to_armbian_params(inputs["vars"], True) + inputs["configs"]) # image build is "build" command, omitted here
|
||||
invocation = " ".join(cmds)
|
||||
|
||||
item = {"desc": desc, "runs_on": runs_on, "invocation": invocation}
|
||||
@@ -123,7 +123,7 @@ def generate_matrix_artifacts(info):
|
||||
|
||||
runs_on = resolve_gha_runner_tags_via_pipeline_gha_config(inputs, artifact_name, artifact_arch)
|
||||
|
||||
cmds = (["artifact"] + armbian_utils.map_to_armbian_params(inputs["vars"]) + inputs["configs"])
|
||||
cmds = (["artifact"] + armbian_utils.map_to_armbian_params(inputs["vars"], True) + inputs["configs"])
|
||||
invocation = " ".join(cmds)
|
||||
|
||||
item = {"desc": desc, "runs_on": runs_on, "invocation": invocation}
|
||||
|
||||
@@ -154,7 +154,7 @@ for artifact_id in info["artifacts"]:
|
||||
runs_on = ["self-hosted", "Linux", "alfa"]
|
||||
|
||||
inputs = artifact['in']['original_inputs']
|
||||
cmds = (["artifact"] + armbian_utils.map_to_armbian_params(inputs["vars"]) + inputs["configs"])
|
||||
cmds = (["artifact"] + armbian_utils.map_to_armbian_params(inputs["vars"], True) + inputs["configs"])
|
||||
invocation = " ".join(cmds)
|
||||
|
||||
item = {"desc": desc, "runs_on": runs_on, "invocation": invocation}
|
||||
@@ -195,7 +195,7 @@ for image_id in info["images"]:
|
||||
runs_on = ["self-hosted", "Linux", f"image-{image_arch}"]
|
||||
|
||||
inputs = image['in']
|
||||
cmds = (armbian_utils.map_to_armbian_params(inputs["vars"]) + inputs["configs"]) # image build is "build" command, omitted here
|
||||
cmds = (armbian_utils.map_to_armbian_params(inputs["vars"], True) + inputs["configs"]) # image build is "build" command, omitted here
|
||||
invocation = " ".join(cmds)
|
||||
|
||||
iJob: ImageJob = ImageJob(f"image-{image_id}", f"{desc}")
|
||||
|
||||
Reference in New Issue
Block a user