Commit d52d2fb8 authored by Mitar's avatar Mitar

Optional cleaning.

parent 17a1acc8
......@@ -18,7 +18,7 @@ validate:
GIT_STRATEGY: clone
script:
- python3 ./run_validation.py
- python3 ./run_validation.py --clean
validate_devel:
stage: build
......@@ -40,7 +40,7 @@ validate_devel:
GIT_STRATEGY: clone
script:
- python3 ./run_validation.py --devel
- python3 ./run_validation.py --devel --clean
allow_failure: true
......
......@@ -105,6 +105,10 @@ parser.add_argument(
'-p', '--password',
help="password to use for accessing gitlab.datadrivendiscovery.org"
)
parser.add_argument(
'-c', '--clean', action='store_true',
help="remove existing Docker images before downloading new ones"
)
group = parser.add_mutually_exclusive_group()
group.add_argument(
'-a', '--all', action='store_true',
......@@ -383,15 +387,16 @@ def validate_installation(primitive_names, interface_version, installation, anno
new_cli_interface = True
# Run a container which sleeps until we stop it. First we remove all existing Docker images to make the space for the new one.
print(">>> Removing exiting Docker images.", flush=True)
for image in docker_client.images.list():
# If we already have the image we want to run, we do not remove it.
if docker_image in image.tags:
continue
if arguments.clean:
print(">>> Removing exiting Docker images.", flush=True)
for image in docker_client.images.list():
# If we already have the image we want to run, we do not remove it.
if docker_image in image.tags:
continue
# Otherwise we remove it.
print(">>> Removing Docker image '{docker_image}'.".format(docker_image=image.tags[0] if image.tags else image.id), flush=True)
docker_client.images.remove(image.id, force=True)
# Otherwise we remove it.
print(">>> Removing Docker image '{docker_image}'.".format(docker_image=image.tags[0] if image.tags else image.id), flush=True)
docker_client.images.remove(image.id, force=True)
# Then we pull the latest version of the image.
print(">>> Pulling Docker image '{docker_image}'.".format(docker_image=docker_image), flush=True)
......
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