mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-06-24 18:45:07 +00:00
Compare commits
38 Commits
v14.5.3
...
add-device
Author | SHA1 | Date | |
---|---|---|---|
6f5920cb63 | |||
8244636bf2 | |||
6a01fb361c | |||
ca637b3fb6 | |||
006293bd01 | |||
338b5d79d3 | |||
60dd0daae5 | |||
662b8283a6 | |||
cfc866cf41 | |||
e566badfff | |||
69834c417e | |||
8aa9c62afd | |||
4f29e37fe7 | |||
99e8a36bb5 | |||
669cbe227f | |||
e9156d77f1 | |||
767216c842 | |||
d3018f9061 | |||
37c6ad855b | |||
ca97678358 | |||
3bb0036ba8 | |||
ac9e2a9e7e | |||
52e95e6d0a | |||
c5d2aa7eec | |||
683220e303 | |||
44f09b32fa | |||
d1a0660a3d | |||
ee1987f188 | |||
39e9997d9e | |||
97b8c75043 | |||
7cb8349f29 | |||
6063f4c776 | |||
4899d545f1 | |||
115bf6433d | |||
e5ce1ade89 | |||
9c4174ea8a | |||
cf16957195 | |||
4de369ff95 |
38
.github/actions/always/action.yml
vendored
38
.github/actions/always/action.yml
vendored
@ -1,38 +0,0 @@
|
||||
---
|
||||
name: cleanup
|
||||
# https://github.com/product-os/flowzone/tree/master/.github/actions
|
||||
inputs:
|
||||
json:
|
||||
description: "JSON stringified object containing all the inputs from the calling workflow"
|
||||
required: true
|
||||
secrets:
|
||||
description: "JSON stringified object containing all the secrets from the calling workflow"
|
||||
required: true
|
||||
|
||||
# --- custom environment
|
||||
VERBOSE:
|
||||
type: string
|
||||
default: "true"
|
||||
|
||||
runs:
|
||||
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
|
||||
using: "composite"
|
||||
steps:
|
||||
# delete draft releases if the pull request is closed without merging
|
||||
- name: Delete draft release
|
||||
if: |
|
||||
runner.os == 'Linux' &&
|
||||
github.event_name == 'pull_request' &&
|
||||
github.event.pull_request.merged == false &&
|
||||
github.event.action == 'closed'
|
||||
|
||||
shell: bash --noprofile --norc -eo pipefail -x {0}
|
||||
run: |
|
||||
set -ea
|
||||
|
||||
[[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x
|
||||
|
||||
gh release delete --yes '${{ github.event.pull_request.head.ref }}' || true
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ fromJSON(inputs.secrets).FLOWZONE_TOKEN }}
|
54
.github/actions/finalize/action.yml
vendored
54
.github/actions/finalize/action.yml
vendored
@ -1,54 +0,0 @@
|
||||
---
|
||||
name: publish GitHub release
|
||||
# https://github.com/product-os/flowzone/tree/master/.github/actions
|
||||
inputs:
|
||||
json:
|
||||
description: "JSON stringified object containing all the inputs from the calling workflow"
|
||||
required: true
|
||||
secrets:
|
||||
description: "JSON stringified object containing all the secrets from the calling workflow"
|
||||
required: true
|
||||
|
||||
runs:
|
||||
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Get release version
|
||||
if: runner.os == 'Linux'
|
||||
id: get_release
|
||||
shell: bash --noprofile --norc -eo pipefail -x {0}
|
||||
run: |
|
||||
set -ea
|
||||
|
||||
[[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x
|
||||
|
||||
echo "version=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT
|
||||
|
||||
# https://docs.github.com/en/rest/releases
|
||||
- name: Finalize GitHub release
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash --noprofile --norc -eo pipefail -x {0}
|
||||
run: |
|
||||
set -ea
|
||||
|
||||
[[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x
|
||||
|
||||
previous_tag="$(git tag --sort=-version:refname | head -n 2 | tail -n 1)"
|
||||
release_notes="$(git log ${previous_tag}..HEAD --pretty=reference)"
|
||||
|
||||
gh release edit '${{ github.event.pull_request.head.ref }}' \
|
||||
--notes "${release_notes}" \
|
||||
--title 'v${{ steps.get_release.outputs.version }}' \
|
||||
--tag 'v${{ steps.get_release.outputs.version }}' \
|
||||
--prerelease=false \
|
||||
--draft=false
|
||||
|
||||
release_id="$(gh api "/repos/${{ github.repository }}/releases/tags/v${{ steps.get_release.outputs.version }}" \
|
||||
-H 'Accept: application/vnd.github+json' | jq -r .id)"
|
||||
|
||||
gh api --method PATCH "/repos/${{ github.repository }}/releases/${release_id}" \
|
||||
-H 'Accept: application/vnd.github+json' \
|
||||
-F make_latest="true"
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ fromJSON(inputs.secrets).FLOWZONE_TOKEN }}
|
34
.github/actions/publish/action.yml
vendored
34
.github/actions/publish/action.yml
vendored
@ -44,13 +44,13 @@ runs:
|
||||
|
||||
- name: Install additional tools
|
||||
if: runner.os == 'Windows'
|
||||
shell: bash --noprofile --norc -eo pipefail -x {0}
|
||||
shell: bash
|
||||
run: |
|
||||
choco install yq
|
||||
|
||||
- name: Install additional tools
|
||||
if: runner.os == 'macOS'
|
||||
shell: bash --noprofile --norc -eo pipefail -x {0}
|
||||
shell: bash
|
||||
run: |
|
||||
brew install coreutils
|
||||
|
||||
@ -83,8 +83,7 @@ runs:
|
||||
# https://github.com/product-os/scripts/tree/master/shared
|
||||
# https://github.com/product-os/balena-concourse/blob/master/pipelines/github-events/template.yml
|
||||
- name: Package release
|
||||
id: package_release
|
||||
shell: bash --noprofile --norc -eo pipefail -x {0}
|
||||
shell: bash
|
||||
run: |
|
||||
set -ea
|
||||
|
||||
@ -114,8 +113,6 @@ runs:
|
||||
|
||||
find dist -type f -maxdepth 1
|
||||
|
||||
echo "version=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT
|
||||
|
||||
env:
|
||||
# https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/#improvements-for-public-repository-forks
|
||||
# https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks#about-workflow-runs-from-public-forks
|
||||
@ -126,28 +123,9 @@ runs:
|
||||
XCODE_APP_LOADER_EMAIL: ${{ inputs.XCODE_APP_LOADER_EMAIL }}
|
||||
XCODE_APP_LOADER_PASSWORD: ${{ fromJSON(inputs.secrets).XCODE_APP_LOADER_PASSWORD }}
|
||||
|
||||
# https://github.com/softprops/action-gh-release#-customizing
|
||||
- name: Create draft GitHub (pre)release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
# use PR branch name for draft releases
|
||||
name: ${{ github.event.pull_request.head.ref }}
|
||||
tag_name: ${{ github.event.pull_request.head.ref }}
|
||||
draft: true
|
||||
prerelease: true
|
||||
token: ${{ fromJSON(inputs.secrets).FLOWZONE_TOKEN }}
|
||||
files: |
|
||||
dist/*.pkg
|
||||
dist/*.exe
|
||||
dist/*.zip
|
||||
|
||||
- name: Compress custom source
|
||||
shell: pwsh
|
||||
run: tar -acf ${{ runner.temp }}/custom.tgz .
|
||||
|
||||
- name: Upload custom artifact
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: custom-${{ github.event.pull_request.head.sha || github.event.head_commit.id }}-${{ runner.os }}
|
||||
path: ${{ runner.temp }}/custom.tgz
|
||||
name: gh-release-${{ github.event.pull_request.head.sha || github.event.head_commit.id }}
|
||||
path: dist
|
||||
retention-days: 1
|
||||
|
15
.github/actions/test/action.yml
vendored
15
.github/actions/test/action.yml
vendored
@ -22,19 +22,6 @@ runs:
|
||||
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Delete previous draft release
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash --noprofile --norc -eo pipefail -x {0}
|
||||
run: |
|
||||
set -ea
|
||||
|
||||
[[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x
|
||||
|
||||
gh release delete --yes '${{ github.event.pull_request.head.ref }}' || true
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ fromJSON(inputs.secrets).FLOWZONE_TOKEN }}
|
||||
|
||||
# https://github.com/actions/setup-node#caching-global-packages-data
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
@ -43,7 +30,7 @@ runs:
|
||||
cache: npm
|
||||
|
||||
- name: Test release
|
||||
shell: bash --noprofile --norc -eo pipefail -x {0}
|
||||
shell: bash
|
||||
run: |
|
||||
set -ea
|
||||
|
||||
|
2
.github/workflows/flowzone.yml
vendored
2
.github/workflows/flowzone.yml
vendored
@ -13,4 +13,4 @@ jobs:
|
||||
uses: product-os/flowzone/.github/workflows/flowzone.yml@master
|
||||
secrets: inherit
|
||||
with:
|
||||
tests_run_on: '["ubuntu-latest","macos-latest","windows-2019"]'
|
||||
tests_run_on: '["ubuntu-20.04","macos-11","windows-2019"]'
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,7 +10,6 @@
|
||||
*.seed
|
||||
/.idea/
|
||||
/.lock-wscript
|
||||
/.nvmrc
|
||||
/.nyc_output/
|
||||
/.vscode/
|
||||
/coverage/
|
||||
|
@ -1,3 +1,168 @@
|
||||
- commits:
|
||||
- subject: "patch: update balena-preload to 12.2.0"
|
||||
hash: ca637b3fb669cd8997ceb70201d4cabe0c621ecf
|
||||
body: ""
|
||||
footer: {}
|
||||
author: Edwin Joassart
|
||||
nested: []
|
||||
version: 14.5.15
|
||||
title: ""
|
||||
date: 2022-12-12T13:41:11.847Z
|
||||
- commits:
|
||||
- subject: Bump multicast-dns to rebased commit (again)
|
||||
hash: 60dd0daae5682c797ad5ac6fec94ccb7b91c5264
|
||||
body: >
|
||||
A recent PR reverted the multicast-dns commit bump from PR #2401. This
|
||||
means that
|
||||
|
||||
under some conditions, `npm install` will fail.
|
||||
|
||||
|
||||
See: https://github.com/balena-io-modules/multicast-dns/pull/1
|
||||
|
||||
See: https://github.com/balena-io/balena-cli/pull/2401
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: pipex
|
||||
nested: []
|
||||
version: 14.5.14
|
||||
title: ""
|
||||
date: 2022-12-11T21:46:37.025Z
|
||||
- commits:
|
||||
- subject: Build on macos-11 for library compatibility reasons
|
||||
hash: e566badfffbe54a44f8fdd627fc8a78a5ecc204f
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: Page-
|
||||
nested: []
|
||||
- subject: Build on ubuntu-20.04 for library compatibility reasons
|
||||
hash: 69834c417e2aa2d2c20a9749319fc72bb6e563fa
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: Page-
|
||||
nested: []
|
||||
version: 14.5.13
|
||||
title: ""
|
||||
date: 2022-12-08T14:00:25.894Z
|
||||
- commits:
|
||||
- subject: Move GH publishing to FZ core
|
||||
hash: 99e8a36bb581ac84619ecba452c5afa3d56dae94
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: ab77
|
||||
nested: []
|
||||
version: 14.5.12
|
||||
title: ""
|
||||
date: 2022-11-21T18:46:45.663Z
|
||||
- commits:
|
||||
- subject: Adding .nvmrc so we can use nvm use instead of hunting for version
|
||||
hash: 767216c842569a523540b7d4d32133c4e53c7596
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: zoobot
|
||||
nested: []
|
||||
version: 14.5.11
|
||||
title: ""
|
||||
date: 2022-11-17T18:32:46.270Z
|
||||
- commits:
|
||||
- subject: Fix surfacing incompatible device type errors as not recognized
|
||||
hash: ca9767835852da53758f8e9713db85357f22ba8b
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
|
||||
signed-off-by: Thodoris Greasidis <thodoris@balena.io>
|
||||
author: Thodoris Greasidis
|
||||
nested: []
|
||||
version: 14.5.10
|
||||
title: ""
|
||||
date: 2022-11-11T11:24:19.344Z
|
||||
- commits:
|
||||
- subject: Prevent git from existing with 141
|
||||
hash: 52e95e6d0a96cfb07c111b927f3f8b0607063b99
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: ab77
|
||||
nested: []
|
||||
version: 14.5.9
|
||||
title: ""
|
||||
date: 2022-11-11T00:49:23.691Z
|
||||
- commits:
|
||||
- subject: Replace missing input
|
||||
hash: 44f09b32fac79c387681f6988e6c621fb0e1ad15
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: ab77
|
||||
nested: []
|
||||
version: 14.5.8
|
||||
title: ""
|
||||
date: 2022-11-10T23:32:18.629Z
|
||||
- commits:
|
||||
- subject: Just ignore errors during publish
|
||||
hash: 39e9997d9e0a8622d0fc255afe508131a33a9123
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: ab77
|
||||
nested: []
|
||||
version: 14.5.7
|
||||
title: ""
|
||||
date: 2022-11-10T22:19:20.861Z
|
||||
- commits:
|
||||
- subject: Ignore PIPE signal
|
||||
hash: 6063f4c7762140731a42dd1e5515ce3326b4cb91
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: ab77
|
||||
nested: []
|
||||
version: 14.5.6
|
||||
title: ""
|
||||
date: 2022-11-10T21:07:32.419Z
|
||||
- commits:
|
||||
- subject: Don't pipefail
|
||||
hash: e5ce1ade892ddddd8a34209b83dcafaeb53a0051
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: ab77
|
||||
nested: []
|
||||
version: 14.5.5
|
||||
title: ""
|
||||
date: 2022-11-10T20:07:10.573Z
|
||||
- commits:
|
||||
- subject: Error when the device type and image parameters do not match
|
||||
hash: 4de369ff956a4da2a34ddb8f54cf3fcef10a9ec2
|
||||
body: ""
|
||||
footer:
|
||||
Resolves: "#2537"
|
||||
resolves: "#2537"
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
|
||||
signed-off-by: Thodoris Greasidis <thodoris@balena.io>
|
||||
author: Thodoris Greasidis
|
||||
nested: []
|
||||
version: 14.5.4
|
||||
title: ""
|
||||
date: 2022-11-10T18:31:18.648Z
|
||||
- commits:
|
||||
- subject: Switch to Flowzone
|
||||
hash: 19144163eeed93a6b68b91715d87e043879a8d51
|
||||
|
49
CHANGELOG.md
49
CHANGELOG.md
@ -4,6 +4,55 @@ All notable changes to this project will be documented in this file
|
||||
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## 14.5.15 - 2022-12-12
|
||||
|
||||
* patch: update balena-preload to 12.2.0 [Edwin Joassart]
|
||||
|
||||
## 14.5.14 - 2022-12-11
|
||||
|
||||
* Bump multicast-dns to rebased commit (again) [pipex]
|
||||
|
||||
## 14.5.13 - 2022-12-08
|
||||
|
||||
* Build on macos-11 for library compatibility reasons [Page-]
|
||||
* Build on ubuntu-20.04 for library compatibility reasons [Page-]
|
||||
|
||||
## 14.5.12 - 2022-11-21
|
||||
|
||||
* Move GH publishing to FZ core [ab77]
|
||||
|
||||
## 14.5.11 - 2022-11-17
|
||||
|
||||
* Adding .nvmrc so we can use nvm use instead of hunting for version [zoobot]
|
||||
|
||||
## 14.5.10 - 2022-11-11
|
||||
|
||||
* Fix surfacing incompatible device type errors as not recognized [Thodoris Greasidis]
|
||||
|
||||
## 14.5.9 - 2022-11-11
|
||||
|
||||
* Prevent git from existing with 141 [ab77]
|
||||
|
||||
## 14.5.8 - 2022-11-10
|
||||
|
||||
* Replace missing input [ab77]
|
||||
|
||||
## 14.5.7 - 2022-11-10
|
||||
|
||||
* Just ignore errors during publish [ab77]
|
||||
|
||||
## 14.5.6 - 2022-11-10
|
||||
|
||||
* Ignore PIPE signal [ab77]
|
||||
|
||||
## 14.5.5 - 2022-11-10
|
||||
|
||||
* Don't pipefail [ab77]
|
||||
|
||||
## 14.5.4 - 2022-11-10
|
||||
|
||||
* Error when the device type and image parameters do not match [Thodoris Greasidis]
|
||||
|
||||
## 14.5.3 - 2022-11-10
|
||||
|
||||
* Switch to Flowzone [ab77]
|
||||
|
@ -12,7 +12,7 @@ _balena() {
|
||||
# Sub-completions
|
||||
api_key_cmds=( generate )
|
||||
config_cmds=( generate inject read reconfigure write )
|
||||
device_cmds=( deactivate identify init local-mode move os-update pin public-url purge reboot register rename restart rm shutdown track-fleet )
|
||||
device_cmds=( deactivate identify init local-mode move os-update pin public-url purge reboot register rename restart rm services shutdown track-fleet )
|
||||
devices_cmds=( supported )
|
||||
env_cmds=( add rename rm )
|
||||
fleet_cmds=( create pin purge rename restart rm track-latest )
|
||||
|
@ -11,7 +11,7 @@ _balena_complete()
|
||||
# Sub-completions
|
||||
api_key_cmds="generate"
|
||||
config_cmds="generate inject read reconfigure write"
|
||||
device_cmds="deactivate identify init local-mode move os-update pin public-url purge reboot register rename restart rm shutdown track-fleet"
|
||||
device_cmds="deactivate identify init local-mode move os-update pin public-url purge reboot register rename restart rm services shutdown track-fleet"
|
||||
devices_cmds="supported"
|
||||
env_cmds="add rename rm"
|
||||
fleet_cmds="create pin purge rename restart rm track-latest"
|
||||
|
93
lib/commands/device/services.ts
Normal file
93
lib/commands/device/services.ts
Normal file
@ -0,0 +1,93 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2016-2020 Balena Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { flags } from '@oclif/command';
|
||||
import type { IArg } from '@oclif/parser/lib/args';
|
||||
import { ImageInstall } from 'balena-sdk';
|
||||
import Command from '../../command';
|
||||
import * as cf from '../../utils/common-flags';
|
||||
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
|
||||
import { getExpandedProp } from '../../utils/pine';
|
||||
|
||||
interface FlagsDef {
|
||||
help: void;
|
||||
}
|
||||
|
||||
interface ArgsDef {
|
||||
uuid: string;
|
||||
}
|
||||
|
||||
interface AugmentedImageInstall extends ImageInstall {
|
||||
name?: string;
|
||||
release?: string;
|
||||
}
|
||||
|
||||
export default class DeviceServicesCmd extends Command {
|
||||
public static description = stripIndent`
|
||||
Show info about a device's services.
|
||||
|
||||
Show info about a device's services.
|
||||
`;
|
||||
public static examples = ['$ balena device services 23c73a1'];
|
||||
|
||||
public static args: Array<IArg<any>> = [
|
||||
{
|
||||
name: 'uuid',
|
||||
description: 'the uuid of the device whose services to show info about',
|
||||
required: true,
|
||||
},
|
||||
];
|
||||
|
||||
public static usage = 'device services <uuid>';
|
||||
|
||||
public static flags: flags.Input<FlagsDef> = {
|
||||
help: cf.help,
|
||||
};
|
||||
|
||||
public static authenticated = true;
|
||||
|
||||
public async run() {
|
||||
const { args: params } = this.parse<FlagsDef, ArgsDef>(DeviceServicesCmd);
|
||||
|
||||
const balena = getBalenaSdk();
|
||||
|
||||
try {
|
||||
const device = await balena.models.device.getWithServiceDetails(
|
||||
params.uuid,
|
||||
);
|
||||
console.log(
|
||||
getVisuals().table.horizontal(
|
||||
device.image_install?.map((imageInstall) => {
|
||||
const newImageInstall: AugmentedImageInstall = { ...imageInstall };
|
||||
newImageInstall.name = getExpandedProp(
|
||||
getExpandedProp(imageInstall.image, 'is_a_build_of__service')!,
|
||||
'service_name',
|
||||
);
|
||||
newImageInstall.release = getExpandedProp(
|
||||
imageInstall.is_provided_by__release,
|
||||
'commit',
|
||||
);
|
||||
return newImageInstall;
|
||||
}),
|
||||
['name', 'status', 'release', 'id'],
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
@ -177,7 +177,16 @@ const messages: {
|
||||
Looks like the session token has expired.
|
||||
Try logging in again with the "balena login" command.`,
|
||||
|
||||
BalenaInvalidDeviceType: (error: Error & { deviceTypeSlug?: string }) => {
|
||||
BalenaInvalidDeviceType: (
|
||||
error: Error & { deviceTypeSlug?: string; type?: string },
|
||||
) => {
|
||||
// TODO: The SDK should be throwing a different Error for this case.
|
||||
if (
|
||||
typeof error.type === 'string' &&
|
||||
error.type.startsWith('Incompatible ')
|
||||
) {
|
||||
return error.type;
|
||||
}
|
||||
const slug = error.deviceTypeSlug ? `"${error.deviceTypeSlug}"` : 'slug';
|
||||
return stripIndent`
|
||||
Device type ${slug} not recognized. Perhaps misspelled?
|
||||
|
@ -107,11 +107,19 @@ export async function getManifest(
|
||||
deviceType: string,
|
||||
): Promise<BalenaSdk.DeviceTypeJson.DeviceType> {
|
||||
const init = await import('balena-device-init');
|
||||
const sdk = getBalenaSdk();
|
||||
const manifest = await init.getImageManifest(image);
|
||||
if (manifest != null) {
|
||||
return manifest;
|
||||
if (
|
||||
manifest != null &&
|
||||
manifest.slug !== deviceType &&
|
||||
manifest.slug !== (await sdk.models.deviceType.get(deviceType)).slug
|
||||
) {
|
||||
const { ExpectedError } = await import('../errors');
|
||||
throw new ExpectedError(
|
||||
`The device type of the provided OS image ${manifest.slug}, does not match the expected device type ${deviceType}`,
|
||||
);
|
||||
}
|
||||
return getBalenaSdk().models.device.getManifestBySlug(deviceType);
|
||||
return manifest ?? (await sdk.models.device.getManifestBySlug(deviceType));
|
||||
}
|
||||
|
||||
export const areDeviceTypesCompatible = async (
|
||||
|
4
npm-shrinkwrap.json
generated
4
npm-shrinkwrap.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "balena-cli",
|
||||
"version": "14.5.3",
|
||||
"version": "14.5.15",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -11454,7 +11454,7 @@
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"multicast-dns": {
|
||||
"version": "git+https://github.com/resin-io-modules/multicast-dns.git#a15c63464eb43e8925b187ed5cb9de6892e8aacc",
|
||||
"version": "git+https://github.com/resin-io-modules/multicast-dns.git#db98d68b79bbefc936b6799de9de1038ba49f85d",
|
||||
"from": "git+https://github.com/resin-io-modules/multicast-dns.git#listen-on-all-interfaces",
|
||||
"requires": {
|
||||
"dns-packet": "^1.0.1",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "balena-cli",
|
||||
"version": "14.5.3",
|
||||
"version": "14.5.15",
|
||||
"description": "The official balena Command Line Interface",
|
||||
"main": "./build/app.js",
|
||||
"homepage": "https://github.com/balena-io/balena-cli",
|
||||
@ -207,7 +207,7 @@
|
||||
"balena-errors": "^4.7.1",
|
||||
"balena-image-fs": "^7.0.6",
|
||||
"balena-image-manager": "^8.0.0",
|
||||
"balena-preload": "^12.1.0",
|
||||
"balena-preload": "^12.2.0",
|
||||
"balena-sdk": "^16.28.0",
|
||||
"balena-semver": "^2.3.0",
|
||||
"balena-settings-client": "^4.0.7",
|
||||
@ -284,6 +284,6 @@
|
||||
"windosu": "^0.3.0"
|
||||
},
|
||||
"versionist": {
|
||||
"publishedAt": "2022-11-10T17:20:18.766Z"
|
||||
"publishedAt": "2022-12-12T13:41:12.779Z"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user