mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-19 13:47:52 +00:00
os download: Assume '.prod' suffix by default for all balenaOS versions
Resolves: #2387 Change-type: patch
This commit is contained in:
parent
d827005154
commit
5c40c8d51f
@ -199,14 +199,27 @@ async function resolveOSVersion(
|
|||||||
deviceType: string,
|
deviceType: string,
|
||||||
version: string,
|
version: string,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
if (!['menu', 'menu-esr'].includes(version)) {
|
if (['menu', 'menu-esr'].includes(version)) {
|
||||||
if (version[0] === 'v') {
|
return await selectOSVersionFromMenu(deviceType, version === 'menu-esr');
|
||||||
version = version.slice(1);
|
|
||||||
}
|
|
||||||
return version;
|
|
||||||
}
|
}
|
||||||
|
if (version[0] === 'v') {
|
||||||
|
version = version.slice(1);
|
||||||
|
}
|
||||||
|
// The version must end with either '.dev' or '.prod', as expected
|
||||||
|
// by `balena-image-manager` and the balena SDK. Note that something
|
||||||
|
// like '2.88.4.prod' is not valid semver (https://semver.org/),
|
||||||
|
// so we don't even attempt semver parsing here.
|
||||||
|
if (!version.endsWith('.dev') && !version.endsWith('.prod')) {
|
||||||
|
version += '.prod';
|
||||||
|
}
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
const vs = await getFormattedOsVersions(deviceType, version === 'menu-esr');
|
async function selectOSVersionFromMenu(
|
||||||
|
deviceType: string,
|
||||||
|
esr: boolean,
|
||||||
|
): Promise<string> {
|
||||||
|
const vs = await getFormattedOsVersions(deviceType, esr);
|
||||||
|
|
||||||
const choices = vs.map((v) => ({
|
const choices = vs.map((v) => ({
|
||||||
value: v.rawVersion,
|
value: v.rawVersion,
|
||||||
|
Loading…
Reference in New Issue
Block a user