Skip to content

Commit f797028

Browse files
committed
cmd-generate-release-meta: factor out helper for OCI images
No functional change. Prep for next patch.
1 parent 70e9c90 commit f797028

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/cmd-generate-release-meta

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,17 @@ def get_floating_tag(rel, tags):
103103
return found
104104

105105

106-
# Append the coreos-assembler build json `input_` to `out`, the target release stream.
106+
def populate_oci_image(buildid, oci):
107+
# The `image` field uses a floating tag and the `digest-ref` field uses
108+
# a digest pullspec. See: https://github.com/coreos/stream-metadata-go/pull/46.
109+
tag = get_floating_tag(buildid, oci["tags"])
110+
return {
111+
"image": oci["image"] + f":{tag}",
112+
"digest-ref": oci["image"] + "@" + oci["digest"],
113+
}
114+
115+
116+
# Append the coreos-assembler build meta.json `input_` to `out`, the target release stream.
107117
def append_build(out, input_):
108118
arch = input_.get("coreos-assembler.basearch")
109119

@@ -182,13 +192,7 @@ def append_build(out, input_):
182192
# KubeVirt specific additions: https://github.com/coreos/stream-metadata-go/pull/41
183193
if input_.get("kubevirt", None) is not None:
184194
arch_dict["media"].setdefault("kubevirt", {}).setdefault("image", {})
185-
# The `image` field uses a floating tag and the `digest-ref` field uses
186-
# a digest pullspec. See: https://github.com/coreos/stream-metadata-go/pull/46.
187-
tag = get_floating_tag(input_["buildid"], input_["kubevirt"]["tags"])
188-
arch_dict["media"]["kubevirt"]["image"] = {
189-
"image": input_["kubevirt"]["image"] + f":{tag}",
190-
"digest-ref": input_["kubevirt"]["image"] + "@" + input_["kubevirt"]["digest"],
191-
}
195+
arch_dict["media"]["kubevirt"]["image"] = populate_oci_image(input_["buildid"], input_["kubevirt"])
192196

193197
# Azure: https://github.com/coreos/stream-metadata-go/issues/13
194198
inputaz = input_.get("azure")

0 commit comments

Comments
 (0)