Skip to content

Commit d1296b9

Browse files
authored
check presence of fn image in local cache only when relevant (#2560)
1 parent efbff31 commit d1296b9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

internal/fnruntime/container.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,14 @@ func (f *ContainerFn) prepareImage() error {
181181
return nil
182182
}
183183

184-
// check image existence
185-
foundImageInLocalCache := f.checkImageExistence()
186-
187184
// If ImagePullPolicy is set to "ifNotPresent", we scan the local images
188185
// first. If there is a match, we just return. This can be useful for local
189186
// development to prevent the remote image to accidentally override the
190187
// local image when they use the same name and tag.
191-
if f.ImagePullPolicy == IfNotPresentPull && foundImageInLocalCache {
192-
return nil
188+
if f.ImagePullPolicy == IfNotPresentPull {
189+
if foundInLocalCache := f.checkImageExistence(); foundInLocalCache {
190+
return nil
191+
}
193192
}
194193

195194
// If ImagePullPolicy is set to always (which is the default), we will try

0 commit comments

Comments
 (0)