From c9f93c30c1fa24e4949b2c34341cbbedf00421e9 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Mon, 14 Mar 2022 13:57:12 +0000 Subject: Add enabled flag for sources Sometimes it might be useful to disable a source for an image, e.g. for a plugin that is not used. This may be to reduce image sizes, or restrict the dependencies necessary to build images. This change adds a new 'enabled' option to each source definition. This allows sources, plugins or additions for each source image to be disabled individually. Change-Id: I31ee0744574fb3db96bee2e9f545600de53d9ee4 --- kolla/image/build.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'kolla/image') diff --git a/kolla/image/build.py b/kolla/image/build.py index b137059fa..0ed8cb903 100755 --- a/kolla/image/build.py +++ b/kolla/image/build.py @@ -361,6 +361,10 @@ class BuildTask(DockerTask): return followups def process_source(self, image, source): + if not source['enabled']: + self.logger.debug("Skipping disabled source %s", source['name']) + return + dest_archive = os.path.join(image.path, source['name'] + '-archive') if source.get('type') == 'url': @@ -458,7 +462,8 @@ class BuildTask(DockerTask): archive_path = self.process_source(image, item) if image.status in STATUS_ERRORS: raise ArchivingError - archives.append(archive_path) + if archive_path: + archives.append(archive_path) if archives: for archive in archives: with tarfile.open(archive, 'r') as archive_tar: @@ -1206,6 +1211,7 @@ class KollaWorker(object): installation['name'] = section if installation['type'] == 'git': installation['reference'] = self.conf[section]['reference'] + installation['enabled'] = self.conf[section]['enabled'] return installation all_sections = (set(self.conf._groups.keys()) | -- cgit v1.2.3