Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Add retry-routine to 'docker push' in clipper_docker.cfg.py #655

Merged
merged 4 commits into from
Mar 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions bin/shipyard/clipper_docker.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
from shipyard import Action, CIPrettyLogAction, IsolatedAction, ctx


#####################################
# Travis: Wait and pull/push images #
#####################################
def wait_and_pull_cmd(image_name):
return f"until docker pull {image_name}; do sleep 5; done"


def wait_and_push_cmd(image_name):
return f"until docker push {image_name}; do sleep 5; done"


def create_image_with_context(build_ctx, image, dockerfile, rpc_version=None):
if rpc_version is None:
rpc_version = ""
Expand All @@ -32,8 +43,8 @@ def push_image_with_context(build_ctx, image, push_sha=True, push_version=False)
image_name_version = f"{namespace}/{image}:{version_tag}"

docker_tag = f"docker tag {image_name_sha} {image_name_version}"
docker_push_sha = f"docker push {image_name_sha}"
docker_push_version = f"docker push {image_name_version}"
docker_push_sha = wait_and_push_cmd(image_name_sha)
docker_push_version = wait_and_push_cmd(image_name_version)

commands = [docker_tag]
if push_sha:
Expand All @@ -47,7 +58,7 @@ def push_image_with_context(build_ctx, image, push_sha=True, push_version=False)
image_name_minor_version = f"{namespace}/{image}:{minor_version}"

tag_minor_ver = f"docker tag {image_name_sha} {image_name_minor_version}"
push_minor_ver = f"docker push {image_name_minor_version}"
push_minor_ver = wait_and_push_cmd(image_name_minor_version)
commands.extend([tag_minor_ver, push_minor_ver])

return CIPrettyLogAction(f"publish_{image}", "\n".join(commands), tags=["push"])
Expand Down Expand Up @@ -186,12 +197,6 @@ def create_and_push_with_ctx(
Action.get_action(container) > kubernetes_test_target
Action.get_action(f"publish_{container}") > kubernetes_test_target

################################
# Travis: Wait and pull images #
################################
def wait_and_pull_cmd(image_name):
return f"until docker pull {image_name}; do sleep 5; done"


for container in kubernetes_containers:
wait = IsolatedAction(
Expand Down