mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-04-09 04:14:15 +00:00
Check for correct architecture when preloading, instead of correct device type
Preload will now propose to preload any app that matches the image architecture. Change-type: major Signed-off-by: Alexis Svinartchouk <alexis@resin.io>
This commit is contained in:
parent
f02ed43f33
commit
0c1c108b2b
@ -1215,9 +1215,9 @@ the commit hash for a specific application release to preload, use "latest" to s
|
||||
|
||||
path to a png image to replace the splash screen
|
||||
|
||||
#### --dont-check-device-type
|
||||
#### --dont-check-arch
|
||||
|
||||
Disables check for matching device types in image and application
|
||||
Disables check for matching architecture in image and application
|
||||
|
||||
#### --pin-device-to-release, -p
|
||||
|
||||
|
@ -18,24 +18,46 @@ dockerUtils = require('../utils/docker')
|
||||
|
||||
LATEST = 'latest'
|
||||
|
||||
allDeviceTypes = undefined
|
||||
|
||||
getDeviceTypes = ->
|
||||
Bluebird = require('bluebird')
|
||||
if allDeviceTypes != undefined
|
||||
return Bluebird.resolve(allDeviceTypes)
|
||||
resin = require('resin-sdk').fromSharedOptions()
|
||||
resin.models.config.getDeviceTypes()
|
||||
.tap (dt) ->
|
||||
allDeviceTypes = dt
|
||||
|
||||
getDeviceTypesWithSameArch = (deviceTypeSlug) ->
|
||||
_ = require('lodash')
|
||||
|
||||
getDeviceTypes()
|
||||
.then (deviceTypes) ->
|
||||
deviceType = _.find(deviceTypes, slug: deviceTypeSlug)
|
||||
_(deviceTypes).filter(arch: deviceType.arch).map('slug').value()
|
||||
|
||||
getApplicationsWithSuccessfulBuilds = (deviceType) ->
|
||||
preload = require('resin-preload')
|
||||
resin = require('resin-sdk').fromSharedOptions()
|
||||
|
||||
resin.pine.get
|
||||
resource: 'my_application'
|
||||
options:
|
||||
$filter:
|
||||
device_type: deviceType
|
||||
owns__release:
|
||||
$any:
|
||||
$alias: 'r'
|
||||
$expr:
|
||||
r:
|
||||
status: 'success'
|
||||
$expand: preload.applicationExpandOptions
|
||||
$select: [ 'id', 'app_name', 'device_type', 'commit', 'should_track_latest_release' ]
|
||||
$orderby: 'app_name asc'
|
||||
getDeviceTypesWithSameArch(deviceType)
|
||||
.then (deviceTypes) ->
|
||||
resin.pine.get
|
||||
resource: 'my_application'
|
||||
options:
|
||||
$filter:
|
||||
device_type:
|
||||
$in: deviceTypes
|
||||
owns__release:
|
||||
$any:
|
||||
$alias: 'r'
|
||||
$expr:
|
||||
r:
|
||||
status: 'success'
|
||||
$expand: preload.applicationExpandOptions
|
||||
$select: [ 'id', 'app_name', 'device_type', 'commit', 'should_track_latest_release' ]
|
||||
$orderby: 'app_name asc'
|
||||
|
||||
selectApplication = (deviceType) ->
|
||||
visuals = require('resin-cli-visuals')
|
||||
@ -144,9 +166,9 @@ module.exports =
|
||||
alias: 's'
|
||||
}
|
||||
{
|
||||
signature: 'dont-check-device-type'
|
||||
signature: 'dont-check-arch'
|
||||
boolean: true
|
||||
description: 'Disables check for matching device types in image and application'
|
||||
description: 'Disables check for matching architecture in image and application'
|
||||
}
|
||||
{
|
||||
signature: 'pin-device-to-release'
|
||||
@ -191,10 +213,10 @@ module.exports =
|
||||
options.splashImage = options['splash-image']
|
||||
delete options['splash-image']
|
||||
|
||||
options.dontCheckDeviceType = options['dont-check-device-type'] || false
|
||||
delete options['dont-check-device-type']
|
||||
if options.dontCheckDeviceType and not options.appId
|
||||
exitWithExpectedError('You need to specify an app id if you disable the device type check.')
|
||||
options.dontCheckArch = options['dont-check-arch'] || false
|
||||
delete options['dont-check-arch']
|
||||
if options.dontCheckArch and not options.appId
|
||||
exitWithExpectedError('You need to specify an app id if you disable the architecture check.')
|
||||
|
||||
options.pinDevice = options['pin-device-to-release'] || false
|
||||
delete options['pin-device-to-release']
|
||||
@ -211,7 +233,7 @@ module.exports =
|
||||
options.image
|
||||
options.splashImage
|
||||
options.proxy
|
||||
options.dontCheckDeviceType
|
||||
options.dontCheckArch
|
||||
options.pinDevice
|
||||
)
|
||||
|
||||
|
@ -147,7 +147,7 @@
|
||||
"resin-image-fs": "^5.0.2",
|
||||
"resin-image-manager": "^5.0.0",
|
||||
"resin-multibuild": "^0.5.1",
|
||||
"resin-preload": "^6.3.0",
|
||||
"resin-preload": "^7.0.0",
|
||||
"resin-release": "^1.2.0",
|
||||
"resin-sdk": "10.0.0-beta2",
|
||||
"resin-sdk-preconfigured": "^6.9.0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user