mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-24 19:01:09 +00:00
Remove unused codepaths that do deltas from resin/scratch
The supervisor has been doing regular pulls instead of deltas from scratch for a while now. We remove remaining references to resin/scratch, and add a handler in docker-utils to fall back to a regular pull with a null deltaSource (which should never be called anyways, but is left as a precaution). Change-type: patch Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
This commit is contained in:
parent
8298487a88
commit
4bf6f75a4f
@ -793,7 +793,7 @@ module.exports = class ApplicationManager extends EventEmitter
|
|||||||
for availableImage in available
|
for availableImage in available
|
||||||
if availableImage.appId == image.appId
|
if availableImage.appId == image.appId
|
||||||
return availableImage.name
|
return availableImage.name
|
||||||
return 'resin/scratch'
|
return null
|
||||||
|
|
||||||
# returns:
|
# returns:
|
||||||
# imagesToRemove: images that
|
# imagesToRemove: images that
|
||||||
|
@ -59,7 +59,7 @@ module.exports = class Images extends EventEmitter
|
|||||||
.catch =>
|
.catch =>
|
||||||
@reportChange(image.imageId, _.merge(_.clone(image), { status: 'Downloading', downloadProgress: 0 }))
|
@reportChange(image.imageId, _.merge(_.clone(image), { status: 'Downloading', downloadProgress: 0 }))
|
||||||
Promise.try =>
|
Promise.try =>
|
||||||
if validation.checkTruthy(opts.delta) and opts.deltaSource? and opts.deltaSource != 'resin/scratch'
|
if validation.checkTruthy(opts.delta) and opts.deltaSource?
|
||||||
@logger.logSystemEvent(logTypes.downloadImageDelta, { image })
|
@logger.logSystemEvent(logTypes.downloadImageDelta, { image })
|
||||||
@inspectByName(opts.deltaSource)
|
@inspectByName(opts.deltaSource)
|
||||||
.then (srcImage) =>
|
.then (srcImage) =>
|
||||||
|
@ -59,14 +59,13 @@ module.exports = class DockerUtils extends DockerToolbelt
|
|||||||
{
|
{
|
||||||
deltaRequestTimeout, deltaApplyTimeout, deltaRetryCount, deltaRetryInterval,
|
deltaRequestTimeout, deltaApplyTimeout, deltaRetryCount, deltaRetryInterval,
|
||||||
uuid, currentApiKey, deltaEndpoint, apiEndpoint,
|
uuid, currentApiKey, deltaEndpoint, apiEndpoint,
|
||||||
deltaSource, deltaSourceId, deltaVersion, startFromEmpty = false
|
deltaSource, deltaSourceId, deltaVersion
|
||||||
} = fullDeltaOpts
|
} = fullDeltaOpts
|
||||||
retryCount = checkInt(deltaRetryCount)
|
retryCount = checkInt(deltaRetryCount)
|
||||||
retryInterval = checkInt(deltaRetryInterval)
|
retryInterval = checkInt(deltaRetryInterval)
|
||||||
requestTimeout = checkInt(deltaRequestTimeout)
|
requestTimeout = checkInt(deltaRequestTimeout)
|
||||||
applyTimeout = checkInt(deltaApplyTimeout)
|
applyTimeout = checkInt(deltaApplyTimeout)
|
||||||
version = checkInt(deltaVersion)
|
version = checkInt(deltaVersion)
|
||||||
deltaSource = 'resin/scratch' if startFromEmpty or !deltaSource?
|
|
||||||
deltaSourceId ?= deltaSource
|
deltaSourceId ?= deltaSource
|
||||||
|
|
||||||
log = (str) ->
|
log = (str) ->
|
||||||
@ -76,6 +75,12 @@ module.exports = class DockerUtils extends DockerToolbelt
|
|||||||
log("Unsupported delta version: #{version}. Falling back to regular pull")
|
log("Unsupported delta version: #{version}. Falling back to regular pull")
|
||||||
return @fetchImageWithProgress(imgDest, fullDeltaOpts, onProgress)
|
return @fetchImageWithProgress(imgDest, fullDeltaOpts, onProgress)
|
||||||
|
|
||||||
|
# Since the supervisor never calls this function without a source anymore,
|
||||||
|
# this should never happen, but we handle it anyways.
|
||||||
|
if !deltaSource?
|
||||||
|
log("Falling back to regular pull due to lack of a delta source")
|
||||||
|
return @fetchImageWithProgress(imgDest, fullDeltaOpts, onProgress)
|
||||||
|
|
||||||
docker = this
|
docker = this
|
||||||
|
|
||||||
log("Starting delta to #{imgDest}")
|
log("Starting delta to #{imgDest}")
|
||||||
@ -110,7 +115,7 @@ module.exports = class DockerUtils extends DockerToolbelt
|
|||||||
if not (300 <= res.statusCode < 400 and res.headers['location']?)
|
if not (300 <= res.statusCode < 400 and res.headers['location']?)
|
||||||
throw new Error("Got #{res.statusCode} when requesting image from delta server.")
|
throw new Error("Got #{res.statusCode} when requesting image from delta server.")
|
||||||
deltaUrl = res.headers['location']
|
deltaUrl = res.headers['location']
|
||||||
if deltaSource is 'resin/scratch'
|
if !deltaSource?
|
||||||
deltaSrc = null
|
deltaSrc = null
|
||||||
else
|
else
|
||||||
deltaSrc = deltaSourceId
|
deltaSrc = deltaSourceId
|
||||||
|
Loading…
x
Reference in New Issue
Block a user