Auto-merge for PR #584 via VersionBot

Fix updates when only releaseId and imageId have changed
This commit is contained in:
resin-io-versionbot[bot] 2018-03-14 07:42:47 +00:00 committed by GitHub
commit f99f59c6ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 4 deletions

View File

@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/).
## v7.1.10 - 2018-03-14
* ApplicationManager: try to match available images by imageId to avoid keeping around unused image entries in the db #584 [Pablo Carranza Velez]
* Compose: Emit a change event when a container is renamed, so that the updated imageId and releaseId are reported #584 [Pablo Carranza Velez]
## v7.1.9 - 2018-03-13
* Skip taking the lock when updating the releaseId or imageId for a service that comes from a legacy supervisor #581 [Pablo Carranza Velez]

View File

@ -1,7 +1,7 @@
{
"name": "resin-supervisor",
"description": "This is resin.io's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as Resin's API informs it to.",
"version": "7.1.9",
"version": "7.1.10",
"license": "Apache-2.0",
"repository": {
"type": "git",

View File

@ -903,7 +903,8 @@ module.exports = class ApplicationManager extends EventEmitter
allImagesForTargetApp = (app) -> _.map(app.services, imageForService)
allImagesForCurrentApp = (app) ->
_.map app.services, (service) ->
_.omit(_.find(available, { dockerImageId: service.image }), [ 'dockerImageId', 'id' ])
img = _.find(available, { dockerImageId: service.image, imageId: service.imageId }) ? _.find(available, { dockerImageId: service.image })
return _.omit(img, [ 'dockerImageId', 'id' ])
availableWithoutIds = _.map(available, (image) -> _.omit(image, [ 'dockerImageId', 'id' ]))
currentImages = _.flatMap(current.local.apps, allImagesForCurrentApp)
targetImages = _.flatMap(target.local.apps, allImagesForTargetApp)

View File

@ -32,10 +32,9 @@ module.exports = class ServiceManager extends EventEmitter
if status?
@volatileState[containerId] ?= {}
_.merge(@volatileState[containerId], status)
@emit('change')
else if containerId? and @volatileState[containerId]?
delete @volatileState[containerId]
@emit('change')
@emit('change')
reportNewStatus: (containerId, service, status) =>
@reportChange(containerId, _.merge({ status }, _.pick(service, [ 'imageId', 'appId', 'releaseId', 'commit' ])))
@ -218,6 +217,8 @@ module.exports = class ServiceManager extends EventEmitter
@get(service)
.then (svc) =>
@docker.getContainer(svc.containerId).rename(name: "#{service.serviceName}_#{imageId}_#{releaseId}")
.then =>
@reportChange()
handover: (currentService, targetService) =>
# We set the running container to not restart so that in case of a poweroff