mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-02 03:56:41 +00:00
Send both source tag and Id to delta server
This commit is contained in:
parent
b9eb6836be
commit
d3fea26c11
@ -39,24 +39,24 @@ findSimilarImage = (repoTag) ->
|
|||||||
for repoTag in repoTags
|
for repoTag in repoTags
|
||||||
otherApplication = repoTag[0].split('/')[1]
|
otherApplication = repoTag[0].split('/')[1]
|
||||||
if otherApplication is application
|
if otherApplication is application
|
||||||
return repoTag[1]
|
return repoTag
|
||||||
|
|
||||||
# Otherwise return the image for the most specific supervisor tag (commit hash)
|
# Otherwise return the image for the most specific supervisor tag (commit hash)
|
||||||
for repoTag in repoTags when /resin\/.*-supervisor.*:[0-9a-f]{6}/.test(repoTag[0])
|
for repoTag in repoTags when /resin\/.*-supervisor.*:[0-9a-f]{6}/.test(repoTag[0])
|
||||||
return repoTag[1]
|
return repoTag
|
||||||
|
|
||||||
# Or return *any* supervisor image available
|
# Or return *any* supervisor image available (except latest which is usually a phony tag)
|
||||||
for repoTag in repoTags when /resin\/.*-supervisor.*:/.test(repoTag[0])
|
for repoTag in repoTags when /resin\/.*-supervisor.*:(?!latest)/.test(repoTag[0])
|
||||||
return repoTag[1]
|
return repoTag
|
||||||
|
|
||||||
# If all else fails, return the newest image available
|
# If all else fails, return the newest image available
|
||||||
return repoTags[0][1]
|
return repoTags[0]
|
||||||
|
|
||||||
exports.rsyncImageWithProgress = (imgDest, onProgress) ->
|
exports.rsyncImageWithProgress = (imgDest, onProgress) ->
|
||||||
findSimilarImage(imgDest)
|
findSimilarImage(imgDest)
|
||||||
.spread (imgSrc) ->
|
.spread (imgSrc, imgSrcId) ->
|
||||||
rsyncDiff = new Promise (resolve, reject) ->
|
rsyncDiff = new Promise (resolve, reject) ->
|
||||||
progress request.get("#{config.deltaHost}/api/v1/delta?src=#{imgSrc}&dest=#{imgDest}", timeout: 5 * 60 * 1000)
|
progress request.get("#{config.deltaHost}/api/v1/delta?src=#{imgSrc}&srcId=#{imgSrcId}&dest=#{imgDest}", timeout: 5 * 60 * 1000)
|
||||||
.on 'progress', (progress) ->
|
.on 'progress', (progress) ->
|
||||||
onProgress(percentage: progress.percent)
|
onProgress(percentage: progress.percent)
|
||||||
.on 'end', ->
|
.on 'end', ->
|
||||||
|
Loading…
Reference in New Issue
Block a user