Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race condition when pulling parent image #881

Closed
twaugh opened this issue Nov 8, 2017 · 3 comments
Closed

Race condition when pulling parent image #881

twaugh opened this issue Nov 8, 2017 · 3 comments

Comments

@twaugh
Copy link
Member

twaugh commented Nov 8, 2017

In order to avoid a race condition when pulling the parent image, we tag the image with the name of the OpenShift build:
https://github.com/projectatomic/atomic-reactor/blob/1.6.28/atomic_reactor/plugins/pre_pull_base_image.py#L88-L94

However, we don't use this as the name of the base image in the workflow:
https://github.com/projectatomic/atomic-reactor/blob/1.6.28/atomic_reactor/plugins/pre_pull_base_image.py#L121

Because of this, inspecting the base image later may fail, for example here:
https://github.com/projectatomic/atomic-reactor/blob/1.6.28/atomic_reactor/plugins/pre_inject_yum_repo.py#L158

This is because, meanwhile, some other build using the same parent image may have deleted it:
https://github.com/projectatomic/atomic-reactor/blob/1.6.28/atomic_reactor/plugins/exit_remove_built_image.py#L49-L50

I think the fix is for the pull_base_image plugin to have this line changed:
https://github.com/projectatomic/atomic-reactor/blob/1.6.28/atomic_reactor/plugins/pre_pull_base_image.py#L121
to something like:

self.workflow.builder.set_base_image(buildid_base_image.to_str())

and to remove these unnecessary lines:
https://github.com/projectatomic/atomic-reactor/blob/1.6.28/atomic_reactor/plugins/pre_pull_base_image.py#L115-L119

@vrutkovs
Copy link
Contributor

vrutkovs commented Nov 8, 2017

set_base_image was changed recently to have a correct base image name written to annotations. This is useful for osbs-metrics script.

Perhaps this change should be reverted - there is only one place where "real" base image name is used, so instead we should be storing this somewhere in workflow.builder and change annotation plugin to read it instead

@twaugh
Copy link
Member Author

twaugh commented Nov 9, 2017

Yes, that makes sense.

@twaugh
Copy link
Member Author

twaugh commented Nov 14, 2017

As an alternative:
For dependency graphing we should probably use the Koji build metadata to assemble the inheritance tree for each build which is not itself a parent build. If we do that instead of inspecting Build annotations, we wouldn't need to keep the "real" base image name around at all -- we could instead just no longer record base-image-name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants