Add release list alias for releases command

Change-type: minor
This commit is contained in:
myarmolinsky 2024-09-24 13:46:21 -04:00
parent ca0a3ee147
commit 8d1394a77d
12 changed files with 53 additions and 44 deletions

View File

@ -8,7 +8,7 @@ _balena() {
local context state line curcontext="$curcontext"
# Valid top-level completions
main_commands=( api-key app block build config deploy device devices env envs fleet internal join key keys leave local login logout logs notes orgs os preload push release releases scan settings ssh support tag tags tunnel util version whoami )
main_commands=( api-key app block build config deploy device devices env envs fleet internal join key keys leave local login logout logs notes orgs os preload push release scan settings ssh support tag tags tunnel util version whoami )
# Sub-completions
api_key_cmds=( generate list revoke )
app_cmds=( create )
@ -22,7 +22,7 @@ _balena() {
key_cmds=( add rm )
local_cmds=( configure flash )
os_cmds=( build-config configure download initialize versions )
release_cmds=( finalize invalidate validate )
release_cmds=( finalize invalidate list validate )
tag_cmds=( rm set )

View File

@ -7,7 +7,7 @@ _balena_complete()
local cur prev
# Valid top-level completions
main_commands="api-key app block build config deploy device devices env envs fleet internal join key keys leave local login logout logs notes orgs os preload push release releases scan settings ssh support tag tags tunnel util version whoami"
main_commands="api-key app block build config deploy device devices env envs fleet internal join key keys leave local login logout logs notes orgs os preload push release scan settings ssh support tag tags tunnel util version whoami"
# Sub-completions
api_key_cmds="generate list revoke"
app_cmds="create"
@ -21,7 +21,7 @@ _balena_complete()
key_cmds="add rm"
local_cmds="configure flash"
os_cmds="build-config configure download initialize versions"
release_cmds="finalize invalidate validate"
release_cmds="finalize invalidate list validate"
tag_cmds="rm set"

View File

@ -285,8 +285,8 @@ are encouraged to regularly update the balena CLI to the latest version.
- [release finalize](#release-finalize)
- [release](#release)
- [release invalidate](#release-invalidate)
- [release list](#release-list)
- [release validate](#release-validate)
- [releases](#releases)
- Settings
@ -3581,29 +3581,14 @@ the commit or ID of the release to invalidate
### Options
## release validate
## release list
### Description
### Aliases
Validate a release.
- `releases`
Valid releases are automatically deployed to devices tracking the latest
release if they are finalized.
Examples:
$ balena release validate a777f7345fe3d655c1c981aa642e5555
$ balena release validate 1234567
### Arguments
#### COMMITORID
the commit or ID of the release to validate
### Options
## releases
To use one of the aliases, replace `release list` with the alias.
### Description
@ -3626,8 +3611,8 @@ The 'jq' utility may be helpful for querying JSON fields in shell scripts
Examples:
$ balena releases myorg/myfleet
$ balena releases myorg/myfleet --json
$ balena release list myorg/myfleet
$ balena release list myorg/myfleet --json
### Arguments
@ -3641,6 +3626,28 @@ fleet name or slug (preferred)
produce JSON output instead of tabular output
## release validate
### Description
Validate a release.
Valid releases are automatically deployed to devices tracking the latest
release if they are finalized.
Examples:
$ balena release validate a777f7345fe3d655c1c981aa642e5555
$ balena release validate 1234567
### Arguments
#### COMMITORID
the commit or ID of the release to validate
### Options
# Settings
## settings

View File

@ -79,7 +79,7 @@ export default class DevicePinCmd extends Command {
pinnedRelease
? `This device is currently pinned to ${pinnedRelease}.`
: 'This device is not currently pinned to any release.'
} \n\nTo see a list of all releases this device can be pinned to, run \`balena releases ${appSlug}\`.`,
} \n\nTo see a list of all releases this device can be pinned to, run \`balena release list ${appSlug}\`.`,
);
} else {
await balena.models.device.pinToRelease(params.uuid, releaseToPinTo);

View File

@ -76,7 +76,7 @@ export default class FleetPinCmd extends Command {
pinnedRelease
? `This fleet is currently pinned to ${pinnedRelease}.`
: 'This fleet is not currently pinned to any release.'
} \n\nTo see a list of all releases this fleet can be pinned to, run \`balena releases ${slug}\`.`,
} \n\nTo see a list of all releases this fleet can be pinned to, run \`balena release list ${slug}\`.`,
);
} else {
await balena.models.application.pinToRelease(slug, releaseToPinTo);

View File

@ -22,7 +22,9 @@ import { applicationNameNote } from '../../utils/messages';
import type * as BalenaSdk from 'balena-sdk';
import { jsonInfo } from '../../utils/messages';
export default class ReleasesCmd extends Command {
export default class ReleaseListCmd extends Command {
public static aliases = ['releases'];
public static description = stripIndent`
List all releases of a fleet.
@ -33,8 +35,8 @@ export default class ReleasesCmd extends Command {
${jsonInfo.split('\n').join('\n\t\t')}
`;
public static examples = [
'$ balena releases myorg/myfleet',
'$ balena releases myorg/myfleet --json',
'$ balena release list myorg/myfleet',
'$ balena release list myorg/myfleet --json',
];
public static flags = {
@ -52,7 +54,7 @@ export default class ReleasesCmd extends Command {
public static authenticated = true;
public async run() {
const { args: params, flags: options } = await this.parse(ReleasesCmd);
const { args: params, flags: options } = await this.parse(ReleaseListCmd);
const fields: Array<keyof BalenaSdk.Release> = [
'id',

View File

@ -68,7 +68,7 @@ describe('balena release', function () {
it('should list releases', async () => {
api.expectGetRelease();
api.expectGetApplication();
const { out } = await runCommand('releases someapp');
const { out } = await runCommand('release list someapp');
const lines = cleanOutput(out);
expect(lines.length).to.be.equal(2);
expect(lines[1]).to.contain('142334');
@ -78,7 +78,7 @@ describe('balena release', function () {
it('should list releases as JSON with the -j/--json flag', async () => {
api.expectGetRelease();
api.expectGetApplication();
const { err, out } = await runCommand('releases someapp --json');
const { err, out } = await runCommand('release list someapp --json');
expect(err).to.be.empty;
const json = JSON.parse(out.join(''));
expect(json[0].commit).to.equal('90247b54de4fa7a0a3cbc85e73c68039');

View File

@ -240,10 +240,10 @@
%2: build/commands/release/invalidate.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/release/validate.js
%2: build/commands/release/list.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/releases/index.js
%2: build/commands/release/validate.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/scan/index.js

View File

@ -240,10 +240,10 @@
%2: build/commands/release/invalidate.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/release/validate.js
%2: build/commands/release/list.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/releases/index.js
%2: build/commands/release/validate.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/scan/index.js

View File

@ -240,10 +240,10 @@
%2: build/commands/release/invalidate.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/release/validate.js
%2: build/commands/release/list.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/releases/index.js
%2: build/commands/release/validate.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/scan/index.js

View File

@ -240,10 +240,10 @@
%2: build/commands/release/invalidate.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/release/validate.js
%2: build/commands/release/list.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/releases/index.js
%2: build/commands/release/validate.js
> Warning Entry 'main' not found in %1
%1: node_modules/@oclif/core/package.json
%2: build/commands/scan/index.js

View File

@ -240,10 +240,10 @@
%2: build\commands\release\invalidate.js
> Warning Entry 'main' not found in %1
%1: node_modules\@oclif\core\package.json
%2: build\commands\release\validate.js
%2: build\commands\release\list.js
> Warning Entry 'main' not found in %1
%1: node_modules\@oclif\core\package.json
%2: build\commands\releases\index.js
%2: build\commands\release\validate.js
> Warning Entry 'main' not found in %1
%1: node_modules\@oclif\core\package.json
%2: build\commands\scan\index.js