diff --git a/completion/_balena b/completion/_balena index 483617b2..101cdd18 100644 --- a/completion/_balena +++ b/completion/_balena @@ -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 ) diff --git a/completion/balena-completion.bash b/completion/balena-completion.bash index 4851391e..41e7e127 100644 --- a/completion/balena-completion.bash +++ b/completion/balena-completion.bash @@ -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" diff --git a/docs/balena-cli.md b/docs/balena-cli.md index a52ebde6..4b074086 100644 --- a/docs/balena-cli.md +++ b/docs/balena-cli.md @@ -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 diff --git a/src/commands/device/pin.ts b/src/commands/device/pin.ts index 9e4382c4..dae13ddf 100644 --- a/src/commands/device/pin.ts +++ b/src/commands/device/pin.ts @@ -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); diff --git a/src/commands/fleet/pin.ts b/src/commands/fleet/pin.ts index 3d6df74d..92a19057 100644 --- a/src/commands/fleet/pin.ts +++ b/src/commands/fleet/pin.ts @@ -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); diff --git a/src/commands/release/list.ts b/src/commands/release/list.ts index 09d049e5..d3564372 100644 --- a/src/commands/release/list.ts +++ b/src/commands/release/list.ts @@ -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 = [ 'id', diff --git a/tests/commands/release.spec.ts b/tests/commands/release.spec.ts index 6f42eba8..7c749b6e 100644 --- a/tests/commands/release.spec.ts +++ b/tests/commands/release.spec.ts @@ -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'); diff --git a/tests/test-data/pkg/expected-warnings-darwin-arm64.txt b/tests/test-data/pkg/expected-warnings-darwin-arm64.txt index 31c032ef..95b7895a 100644 --- a/tests/test-data/pkg/expected-warnings-darwin-arm64.txt +++ b/tests/test-data/pkg/expected-warnings-darwin-arm64.txt @@ -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 diff --git a/tests/test-data/pkg/expected-warnings-darwin-x64.txt b/tests/test-data/pkg/expected-warnings-darwin-x64.txt index f8452136..67ada903 100644 --- a/tests/test-data/pkg/expected-warnings-darwin-x64.txt +++ b/tests/test-data/pkg/expected-warnings-darwin-x64.txt @@ -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 diff --git a/tests/test-data/pkg/expected-warnings-linux-arm64.txt b/tests/test-data/pkg/expected-warnings-linux-arm64.txt index 31c032ef..95b7895a 100644 --- a/tests/test-data/pkg/expected-warnings-linux-arm64.txt +++ b/tests/test-data/pkg/expected-warnings-linux-arm64.txt @@ -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 diff --git a/tests/test-data/pkg/expected-warnings-linux-x64.txt b/tests/test-data/pkg/expected-warnings-linux-x64.txt index f8452136..67ada903 100644 --- a/tests/test-data/pkg/expected-warnings-linux-x64.txt +++ b/tests/test-data/pkg/expected-warnings-linux-x64.txt @@ -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 diff --git a/tests/test-data/pkg/expected-warnings-win32-x64.txt b/tests/test-data/pkg/expected-warnings-win32-x64.txt index d99f8db0..bcd0f11d 100644 --- a/tests/test-data/pkg/expected-warnings-win32-x64.txt +++ b/tests/test-data/pkg/expected-warnings-win32-x64.txt @@ -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