From 34138a86c3cd297dae294bb63cc2b1d91b3cac69 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Sun, 10 May 2020 00:16:40 -0400 Subject: [PATCH] builder/buildah: use tenacity to retry failing pushes There are multiple reasons that can prevent the container image push command to fail: - network issue - remote registry error or rate limit This patch will use tenacity to retry the push up to 10 times jittered exponential backoff. Change-Id: If82bf022e9944ce5a224c611ca16c74ca4cc0771 (cherry picked from commit 1fbea6a972ea1a22f716c418762e63462516bd67) --- tripleo_common/image/builder/buildah.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tripleo_common/image/builder/buildah.py b/tripleo_common/image/builder/buildah.py index d6703716e..a1e0519e5 100644 --- a/tripleo_common/image/builder/buildah.py +++ b/tripleo_common/image/builder/buildah.py @@ -17,6 +17,7 @@ from concurrent import futures import os import six +import tenacity from oslo_concurrency import processutils from oslo_log import log as logging @@ -151,6 +152,11 @@ class BuildahBuilder(base.BaseBuilder): use_standard_locale=True ) + @tenacity.retry( # Retry up to 10 times with jittered exponential backoff + reraise=True, + wait=tenacity.wait_random_exponential(multiplier=1, max=15), + stop=tenacity.stop_after_attempt(10) + ) def push(self, destination): """Push an image to a container registry.