mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-06-06 09:31:40 +00:00
Avoid trying to clean up the supervisor image if it has several tags (even though it would never succeed)
Change-Type: patch Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This commit is contained in:
parent
a2287dd8b5
commit
5d7e8afcee
@ -228,9 +228,10 @@ module.exports = class Images extends EventEmitter
|
|||||||
images = []
|
images = []
|
||||||
Promise.join(
|
Promise.join(
|
||||||
@docker.getRegistryAndName(constants.supervisorImage)
|
@docker.getRegistryAndName(constants.supervisorImage)
|
||||||
|
@docker.getImage(constants.supervisorImage).inspect()
|
||||||
@db.models('image').select('dockerImageId')
|
@db.models('image').select('dockerImageId')
|
||||||
.map((image) -> image.dockerImageId)
|
.map((image) -> image.dockerImageId)
|
||||||
(supervisorImageInfo, usedImageIds) =>
|
(supervisorImageInfo, supervisorImage, usedImageIds) =>
|
||||||
isDangling = (image) ->
|
isDangling = (image) ->
|
||||||
# Looks like dangling images show up with these weird RepoTags and RepoDigests sometimes
|
# Looks like dangling images show up with these weird RepoTags and RepoDigests sometimes
|
||||||
(_.isEmpty(image.RepoTags) or _.isEqual(image.RepoTags, [ '<none>:<none>' ])) and
|
(_.isEmpty(image.RepoTags) or _.isEqual(image.RepoTags, [ '<none>:<none>' ])) and
|
||||||
@ -240,7 +241,7 @@ module.exports = class Images extends EventEmitter
|
|||||||
# Cleanup should remove truly dangling images (i.e. dangling and with no digests)
|
# Cleanup should remove truly dangling images (i.e. dangling and with no digests)
|
||||||
if isDangling(image) and not (image.Id in usedImageIds)
|
if isDangling(image) and not (image.Id in usedImageIds)
|
||||||
images.push(image.Id)
|
images.push(image.Id)
|
||||||
else if !_.isEmpty(image.RepoTags)
|
else if !_.isEmpty(image.RepoTags) and image.Id != supervisorImage.Id
|
||||||
# We also remove images from the supervisor repository with a different tag
|
# We also remove images from the supervisor repository with a different tag
|
||||||
Promise.map image.RepoTags, (repoTag) =>
|
Promise.map image.RepoTags, (repoTag) =>
|
||||||
@docker.getRegistryAndName(repoTag)
|
@docker.getRegistryAndName(repoTag)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user