mirror of
https://github.com/containers/podman-compose.git
synced 2025-06-19 19:27:47 +02:00
Also pull images with a build section
This commit is contained in:
parent
ff5b9f1663
commit
2d0aad6692
@ -1215,12 +1215,24 @@ def compose_version(compose, args):
|
|||||||
print("podman-composer version ", __version__)
|
print("podman-composer version ", __version__)
|
||||||
compose.podman.run(["--version"], "", [], sleep=0)
|
compose.podman.run(["--version"], "", [], sleep=0)
|
||||||
|
|
||||||
@cmd_run(podman_compose, 'pull', 'pull stack images')
|
def is_local(container: dict) -> bool:
|
||||||
|
"""Test if a container is local, i.e. if it is
|
||||||
|
* prefixed with localhost/
|
||||||
|
* has a build section and is not prefixed
|
||||||
|
"""
|
||||||
|
return (
|
||||||
|
not "/" in container["image"]
|
||||||
|
if "build" in container
|
||||||
|
else container["image"].startswith("localhost/")
|
||||||
|
)
|
||||||
|
|
||||||
|
@cmd_run(podman_compose, "pull", "pull stack images")
|
||||||
def compose_pull(compose, args):
|
def compose_pull(compose, args):
|
||||||
images = set()
|
img_containers = [cnt for cnt in compose.containers if "image" in cnt]
|
||||||
for cnt in compose.containers:
|
images = {cnt["image"] for cnt in img_containers}
|
||||||
if cnt.get('build', None): continue
|
if not args.force_local:
|
||||||
images.add(cnt["image"])
|
local_images = {cnt["image"] for cnt in img_containers if is_local(cnt)}
|
||||||
|
images -= local_images
|
||||||
for image in images:
|
for image in images:
|
||||||
compose.podman.run([], "pull", [image], sleep=0)
|
compose.podman.run([], "pull", [image], sleep=0)
|
||||||
|
|
||||||
@ -1596,6 +1608,11 @@ def compose_logs_parse(parser):
|
|||||||
parser.add_argument('service', metavar='service', nargs=None,
|
parser.add_argument('service', metavar='service', nargs=None,
|
||||||
help='service name')
|
help='service name')
|
||||||
|
|
||||||
|
@cmd_parse(podman_compose, 'pull')
|
||||||
|
def compose_pull_parse(parser):
|
||||||
|
parser.add_argument("--force-local", action='store_true', default=False,
|
||||||
|
help="Also pull unprefixed images for services which have a build section")
|
||||||
|
|
||||||
@cmd_parse(podman_compose, 'push')
|
@cmd_parse(podman_compose, 'push')
|
||||||
def compose_push_parse(parser):
|
def compose_push_parse(parser):
|
||||||
parser.add_argument("--ignore-push-failures", action='store_true',
|
parser.add_argument("--ignore-push-failures", action='store_true',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user