diff --git a/runbot/models/host.py b/runbot/models/host.py index cb915b1f2..4f42e73f6 100644 --- a/runbot/models/host.py +++ b/runbot/models/host.py @@ -47,6 +47,7 @@ class Host(models.Model): profile = fields.Boolean('Profile', help='Enable profiling on this host') use_remote_docker_registry = fields.Boolean('Use remote Docker Registry', default=False, help="Use docker registry for pulling images") + docker_registry_url = fields.Char('Registry Url', help="Override global registry URL for this host.") def _compute_nb(self): groups = self.env['runbot.build'].read_group( @@ -125,6 +126,7 @@ def _docker_update_images(self): self.ensure_one() icp = self.env['ir.config_parameter'] docker_registry_host = self.browse(int(icp.get_param('runbot.docker_registry_host_id', default=0))) + registry_url = self.registry_url.strip('/') if self.registry_url else f'dockerhub.{docker_registry_host.name}' # pull all images from the runbot docker registry is_registry = docker_registry_host == self all_docker_files = self.env['runbot.dockerfile'].search([]) @@ -133,7 +135,7 @@ def _docker_update_images(self): _logger.info('Pulling docker images...') total_duration = 0 for dockerfile in all_docker_files.filtered('always_pull'): - remote_tag = f'dockerhub.{docker_registry_host.name}/{dockerfile.image_tag}' + remote_tag = f'{registry_url}/{dockerfile.image_tag}' result = docker_pull(remote_tag) if result['success']: result['image'].tag(dockerfile.image_tag) diff --git a/runbot/views/host_views.xml b/runbot/views/host_views.xml index 04eeabf46..80da06e2a 100644 --- a/runbot/views/host_views.xml +++ b/runbot/views/host_views.xml @@ -12,6 +12,7 @@ +