Skip to content

Commit

Permalink
device os-update: Enable updates to pre-release versions of higher ba…
Browse files Browse the repository at this point in the history
  • Loading branch information
thgreasi committed Jan 22, 2024
1 parent 3a7f6d7 commit 400f196
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/commands/device/os-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,21 @@ export default class DeviceOsUpdateCmd extends Command {
);
}

let includeDraft = false;
if (options.version != null) {
const bSemver = await import('balena-semver');
const parsedVersion = bSemver.parse(options.version);
includeDraft =
parsedVersion != null && parsedVersion.prerelease.length > 0;
}

// Get supported OS update versions
const hupVersionInfo = await sdk.models.os.getSupportedOsUpdateVersions(
is_of__device_type[0].slug,
currentOsVersion,
{
includeDraft,
},
);
if (hupVersionInfo.versions.length === 0) {
throw new ExpectedError(
Expand Down

0 comments on commit 400f196

Please sign in to comment.