Commit ce14f3da authored by Noé Gaumont's avatar Noé Gaumont 🐙
Browse files

fix: rewrite push to use generator and fix logging for major tag

Before this patch, the logged information used image.major_tag instead of img.major_tag (previous loop).
parent ff1eb1ad7658
......@@ -297,33 +297,31 @@ def push(images: List[CubicWebImage], last_debian_dist: str):
latest = get_major_tags(images)
succeed_push = []
fail_push = []
for image in images:
res = run("docker", "push", image.tag)
conditionnal_append(succeed_push, fail_push, res.returncode == 0, image.tag)
for major, img in latest.items():
tag = f"{REGISTRY}:{major}"
for onbuild in [None, "onbuild"]:
if onbuild == "onbuild":
tag = f"{REGISTRY}:{major}-{onbuild}"
else:
tag = f"{REGISTRY}:{major}"
res = run("docker", "push", tag)
conditionnal_append(succeed_push, fail_push, res.returncode == 0, tag)
res = run("docker", "push", img.major_tag)
conditionnal_append(
succeed_push, fail_push, res.returncode == 0, image.major_tag
)
minor_tags = (image.tag for image in images)
res = run(
"docker",
"push",
def major_tags_gen():
for major, img in latest.items():
yield f"{REGISTRY}:{major}-onbuild"
yield f"{REGISTRY}:{major}"
if major != 'latest':
yield img.major_tag
buildpackage_tags = (
f"{REGISTRY}:{last_debian_dist}-buildpackage",
f"{REGISTRY}:buildpackage",
)
conditionnal_append(
succeed_push, fail_push, res.returncode == 0, f"{REGISTRY}:buildpackage"
)
for tag in itertools.chain(minor_tags, major_tags_gen(), buildpackage_tags):
print(tag)
# res = run(
# "docker",
# "push",
# tag,
# )
# conditionnal_append(
# succeed_push, fail_push, res.returncode == 0, tag
# )
print_summary("push image", succeed_push, fail_push)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment