Allow building images if parent was skipped

This fixes a bug where if an image had a parent that was skipped, it
would never get built. Normally when a parent finishes building it
triggers the build of its children. This process is kicked off by Kolla
finding the grandparents that have no parents above them. However,
sometimes parents should be skipped, and in this case they would never
get scheduled, and so their children would never build, producing a
strange error without much information.

Fix is to allow building an image if its parent is explicitly marked as
having been skipped.

The use-case for this is when you want to iterate on building an
image without going through the cost of re-running the parent builds. In
particular, if your builds are using Git sources, which break Docker
caches, the cost of parent builds is high and the feedback loop during
development has a much higher latency. Allowing some way for images
to be rebuilt in a targeted manner is helpful when in the development
phase.

Change-Id: I6b6897d20626825bcd235b9a85859644effbd222
Closes-Bug: #1810979
This commit is contained in:
Jason 2019-01-04 13:22:37 -06:00 committed by Jason Anderson
parent f46b1c3b08
commit 8c3cb6b4d2
No known key found for this signature in database
GPG Key ID: 9207452BF63947DD

View File

@ -1247,7 +1247,9 @@ class KollaWorker(object):
# were not matched in the first place... (not worth the
# effort to run them, if they won't be used anyway).
continue
if image.parent is None:
# Build all root nodes, where a root is defined as having no parent
# or having a parent that is explicitly being skipped.
if image.parent is None or image.parent.status == STATUS_SKIPPED:
queue.put(BuildTask(self.conf, image, push_queue))
LOG.info('Added image %s to queue', image.name)