Skip to content

Commit

Permalink
device os-update: Add option for including pre-release versions in th…
Browse files Browse the repository at this point in the history
…e list

Change-type: minor
  • Loading branch information
thgreasi committed Jan 22, 2024
1 parent 41e2871 commit 42160fb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
9 changes: 9 additions & 0 deletions docs/balena-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,7 @@ Examples:
$ balena device os-update 23c73a1
$ balena device os-update 23c73a1 --version 2.101.7
$ balena device os-update 23c73a1 --version 2.31.0+rev1.prod
$ balena device os-update 23c73a1 --include-draft

### Arguments

Expand All @@ -1467,6 +1468,10 @@ the uuid of the device to update

a balenaOS version

#### --include-draft

include pre-release balenaOS versions

#### -y, --yes

answer "yes" to all questions (non interactive use)
Expand Down Expand Up @@ -2723,6 +2728,10 @@ device type

select balenaOS ESR versions

#### --include-draft

include pre-release balenaOS versions

## os download <type>

Download an unconfigured OS image for the specified device type.
Expand Down
11 changes: 9 additions & 2 deletions lib/commands/device/os-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default class DeviceOsUpdateCmd extends Command {
'$ balena device os-update 23c73a1',
'$ balena device os-update 23c73a1 --version 2.101.7',
'$ balena device os-update 23c73a1 --version 2.31.0+rev1.prod',
'$ balena device os-update 23c73a1 --include-draft',
];

public static args = {
Expand All @@ -51,6 +52,12 @@ export default class DeviceOsUpdateCmd extends Command {
public static flags = {
version: Flags.string({
description: 'a balenaOS version',
exclusive: ['include-draft'],
}),
'include-draft': Flags.boolean({
description: 'include pre-release balenaOS versions',
default: false,
exclusive: ['version'],
}),
yes: cf.yes,
help: cf.help,
Expand Down Expand Up @@ -86,8 +93,8 @@ export default class DeviceOsUpdateCmd extends Command {
);
}

let includeDraft = false;
if (options.version != null) {
let includeDraft = options['include-draft'];
if (!includeDraft && options.version != null) {
const bSemver = await import('balena-semver');
const parsedVersion = bSemver.parse(options.version);
includeDraft =
Expand Down

0 comments on commit 42160fb

Please sign in to comment.