Skip to content

Commit 593048a

Browse files
committed
helpful error if the smart selected tag does not exist
1 parent fafadca commit 593048a

File tree

1 file changed

+32
-17
lines changed

1 file changed

+32
-17
lines changed

tests/integration/runner

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ from integration_test_images import get_docker_env
1717

1818
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "ci")))
1919
from digest_helper import DockerDigester
20+
from ci import check_missing_images_on_dockerhub
2021

2122
def random_str(length: int = 6) -> str:
2223
alphabet = string.ascii_lowercase + string.digits
@@ -437,31 +438,45 @@ if __name__ == "__main__":
437438
docker_digester.get_all_digests()
438439
) # 'image name - digest' mapping
439440
if args.docker_image_version is None:
440-
if DIND_INTEGRATION_TESTS_IMAGE_NAME in imagename_digest_dict:
441-
args.docker_image_version = imagename_digest_dict[
442-
DIND_INTEGRATION_TESTS_IMAGE_NAME
443-
]
444-
print(
445-
f"Using DIND integration tests image version {args.docker_image_version}"
446-
)
447-
else:
441+
args.docker_image_version = imagename_digest_dict[
442+
DIND_INTEGRATION_TESTS_IMAGE_NAME
443+
]
444+
print(
445+
f"Calculated digest {args.docker_image_version} for DIND integration tests image"
446+
)
447+
missing_images = check_missing_images_on_dockerhub(
448+
{
449+
DIND_INTEGRATION_TESTS_IMAGE_NAME: args.docker_image_version,
450+
}
451+
)
452+
if missing_images:
448453
print(
449-
f"DIND integration tests image version not found in digests, using latest"
454+
f"Error: The following Docker image with calculated digest does not exist: {missing_images}."
455+
"\nPlease specify manually with --docker-image-version"
450456
)
451-
args.docker_image_version = "latest"
457+
sys.exit(1)
452458

453-
BASE_INTEGRATION_TEST_IMAGE_NAME = "altinityinfra/integration-test"
454-
if (
455-
"DOCKER_BASE_TAG" not in env_tags
456-
and BASE_INTEGRATION_TEST_IMAGE_NAME in imagename_digest_dict
457-
):
459+
if "DOCKER_BASE_TAG" not in env_tags:
460+
BASE_INTEGRATION_TEST_IMAGE_NAME = "altinityinfra/integration-test"
461+
base_integration_image_tag = imagename_digest_dict[
462+
BASE_INTEGRATION_TEST_IMAGE_NAME
463+
]
458464
env_tags += get_docker_env(
459465
BASE_INTEGRATION_TEST_IMAGE_NAME,
460-
imagename_digest_dict[BASE_INTEGRATION_TEST_IMAGE_NAME],
466+
base_integration_image_tag,
461467
)
462468
print(
463-
f"Using base integration test image version {imagename_digest_dict[BASE_INTEGRATION_TEST_IMAGE_NAME]}"
469+
f"Calculated digest {base_integration_image_tag} for base integration test image"
470+
)
471+
missing_images = check_missing_images_on_dockerhub(
472+
{BASE_INTEGRATION_TEST_IMAGE_NAME: base_integration_image_tag}
464473
)
474+
if missing_images:
475+
print(
476+
f"Error: The following Docker image with calculated digest does not exist: {missing_images}."
477+
"\nPlease specify manually with --docker-compose-images-tags"
478+
)
479+
sys.exit(1)
465480

466481
# create named volume which will be used inside to store images and other docker related files,
467482
# to avoid redownloading it every time

0 commit comments

Comments
 (0)