From dda0170a8904769c1903587132aa7315a792d045 Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Wed, 9 Oct 2024 16:09:12 +0200 Subject: [PATCH] [FIX] runbot: avoid trying to push unexisting image When an image is build for the first time and the build fails, an ImageNotfound Exception is raised when trying to push the image. Whith this commit, a warning is emmited instead of crashing in such a case. --- runbot/models/host.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runbot/models/host.py b/runbot/models/host.py index d3cdc1d9..cb915b1f 100644 --- a/runbot/models/host.py +++ b/runbot/models/host.py @@ -1,6 +1,7 @@ import logging from collections import defaultdict +from docker.errors import ImageNotFound from odoo import models, fields, api from odoo.tools import config, ormcache @@ -145,7 +146,10 @@ class Host(models.Model): for dockerfile in self.env['runbot.dockerfile'].search([('to_build', '=', True)]): dockerfile._build(self) if is_registry: - docker_push(dockerfile.image_tag) + try: + docker_push(dockerfile.image_tag) + except ImageNotFound: + _logger.warning("Image tag `%s` not found. Skipping push", dockerfile.image_tag) _logger.info('Cleaning docker images...') for image in docker_images():