Compare commits

...

65 Commits

Author SHA1 Message Date
6f5920cb63 device: Add services command for seeing info about services running on a device
Change-type: minor
Signed-off-by: Matthew Yarmolinsky <matthew-timothy@balena.io>
2022-12-20 16:33:41 -08:00
8244636bf2 v14.5.15 2022-12-12 13:41:15 +00:00
6a01fb361c Merge pull request #2570 from balena-io/aethernet-preload-12.2.0
patch: update balena-preload to 12.2.0
2022-12-12 08:39:46 -05:00
ca637b3fb6 patch: update balena-preload to 12.2.0 2022-12-12 13:16:22 +01:00
006293bd01 v14.5.14 2022-12-11 21:46:38 +00:00
338b5d79d3 Merge pull request #2535 from balena-io/multicast-dns-bump
Bump multicast-dns to rebased commit (again)
2022-12-11 16:45:14 -05:00
60dd0daae5 Bump multicast-dns to rebased commit (again)
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

Change-type: patch
2022-12-11 12:45:49 -08:00
662b8283a6 v14.5.13 2022-12-08 14:00:28 +00:00
cfc866cf41 Merge pull request #2569 from balena-io/gh-runners
Specify gh runner versions for compatibility reasons
2022-12-08 13:58:56 +00:00
e566badfff Build on macos-11 for library compatibility reasons
Change-type: patch
2022-12-08 10:58:40 +00:00
69834c417e Build on ubuntu-20.04 for library compatibility reasons
Change-type: patch
2022-12-08 10:58:25 +00:00
8aa9c62afd v14.5.12 2022-11-21 18:46:49 +00:00
4f29e37fe7 Merge pull request #2565 from balena-io/ab77/operational
Move GH publishing to FZ core
2022-11-21 18:45:25 +00:00
99e8a36bb5 Move GH publishing to FZ core
Change-type: patch
2022-11-21 09:48:09 -08:00
669cbe227f v14.5.11 2022-11-17 18:32:48 +00:00
e9156d77f1 Merge pull request #2532 from balena-io/nvmrc
Adding .nvmrc so we can use nvm use instead of hunting for version
2022-11-17 18:31:28 +00:00
767216c842 Adding .nvmrc so we can use nvm use instead of hunting for version
Change-type: patch
2022-11-16 17:54:42 -08:00
d3018f9061 v14.5.10 2022-11-11 11:24:21 +00:00
37c6ad855b Merge pull request #2557 from balena-io/surface-sdk-incompatible-dt-errors
Surface sdk incompatible dt errors
2022-11-11 11:23:05 +00:00
ca97678358 Fix surfacing incompatible device type errors as not recognized
Change-type: patch
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
2022-11-10 16:52:14 -08:00
3bb0036ba8 v14.5.9 2022-11-11 00:49:26 +00:00
ac9e2a9e7e Merge pull request #2562 from balena-io/ab77/operational
Prevent git from existing with 141
2022-11-11 00:47:34 +00:00
52e95e6d0a Prevent git from existing with 141
Change-type: patch
2022-11-10 15:52:13 -08:00
c5d2aa7eec v14.5.8 2022-11-10 23:32:21 +00:00
683220e303 Merge pull request #2561 from balena-io/ab77/operational
Replace missing input
2022-11-10 23:30:51 +00:00
44f09b32fa Replace missing input
Change-type: patch
2022-11-10 14:33:13 -08:00
d1a0660a3d v14.5.7 2022-11-10 22:19:22 +00:00
ee1987f188 Merge pull request #2560 from balena-io/ab77/operational
Just ignore errors during publish
2022-11-10 22:17:59 +00:00
39e9997d9e Just ignore errors during publish
Change-type: patch
2022-11-10 13:22:29 -08:00
97b8c75043 v14.5.6 2022-11-10 21:07:35 +00:00
7cb8349f29 Merge pull request #2559 from balena-io/ab77/operational
Ignore PIPE signal
2022-11-10 21:06:18 +00:00
6063f4c776 Ignore PIPE signal
Change-type: patch
2022-11-10 12:13:03 -08:00
4899d545f1 v14.5.5 2022-11-10 20:07:12 +00:00
115bf6433d Merge pull request #2558 from balena-io/ab77/operational
Don't pipefail
2022-11-10 20:05:33 +00:00
e5ce1ade89 Don't pipefail
Change-type: patch
2022-11-10 11:13:37 -08:00
9c4174ea8a v14.5.4 2022-11-10 18:31:21 +00:00
cf16957195 Merge pull request #2556 from balena-io/2537-error-on-incompatible-resolved-device-types
Error when the device type and image parameters do not match
2022-11-10 18:30:05 +00:00
4de369ff95 Error when the device type and image parameters do not match
Resolves: #2537
Change-type: patch
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
2022-11-10 09:37:22 -08:00
ac3ebff8ee v14.5.3 2022-11-10 17:20:19 +00:00
76b01d92d3 Merge pull request #2555 from balena-io/ab77/operational
Switch to Flowzone
2022-11-10 17:18:49 +00:00
19144163ee Switch to Flowzone
Change-type: patch
2022-11-08 20:56:47 -08:00
535ffccbad v14.5.2 2022-10-21 20:15:35 +03:00
6f5ada9692 Merge pull request #2553 from balena-io/stop-waiting-for-the-analytics-response
Stop waiting for the analytics response
2022-10-21 17:09:08 +00:00
1c7d9255ae Stop waiting for the analytics response
Change-type: patch
See: https://balena.zulipchat.com/#narrow/stream/345884-aspect.2Fanalytics/topic/Balena.20CLI.20analytics-performance
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
2022-10-21 19:07:39 +03:00
807e6ea2ad v14.5.1 2022-10-21 15:48:13 +03:00
c76f019fd0 Merge pull request #2552 from balena-io/bump-parse-link-header-2.0.0
Bump parse-link-header from 1.0.1 to 2.0.0
2022-10-21 12:45:48 +00:00
3c2c925eed Bump parse-link-header from 1.0.1 to 2.0.0
Bumps [parse-link-header](https://github.com/thlorenz/parse-link-header) from 1.0.1 to 2.0.0.
- [Release notes](https://github.com/thlorenz/parse-link-header/releases)
- [Commits](https://github.com/thlorenz/parse-link-header/compare/v1.0.1...v2.0.0)

---
updated-dependencies:
- dependency-name: parse-link-header
  dependency-type: direct:development
...

Change-type: patch
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-20 20:10:53 +03:00
14b54be15e v14.5.0 2022-10-18 15:17:13 +03:00
7fb82f7447 Merge pull request #2539 from balena-io/send-tracking-to-analytics-backend
changes analytics endpoint to analytics-backend
2022-10-18 12:14:05 +00:00
4a5d44a0f1 Merge branch 'master' into send-tracking-to-analytics-backend 2022-10-18 08:15:33 -03:00
1cba0284df v14.4.4 2022-10-18 13:36:52 +03:00
6e4fe229bf Merge pull request #2546 from balena-io/update-simple-git
Update simple git
2022-10-18 10:33:17 +00:00
7033075900 Update simple-git to 3.14.1
Change-type: patch
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
2022-10-18 09:45:24 +03:00
ded268ff3c automation/check-doc: Convert to typescript 2022-10-18 09:45:24 +03:00
a366f0b7eb automation/check-doc: Rename to .ts 2022-10-18 09:45:24 +03:00
507c8a1bfd v14.4.3 2022-10-18 00:24:29 +03:00
1fb46bfa5d Merge pull request #2545 from balena-io/config-generate-incompatible-dt-error
config generate: Fix the incompatible arch errors showing as not found
2022-10-17 21:20:21 +00:00
2e115968d5 config generate: Fix the incompatible arch errors showing as not found
Change-type: patch
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
2022-10-17 23:44:08 +03:00
83020797b0 v14.4.2 2022-10-17 21:15:25 +03:00
0c4647e980 Merge pull request #2544 from balena-io/no-device-type-json-arch-aliases
Stop relying on device-type.json for resolving the cpu architecture
2022-10-17 18:06:05 +00:00
a20d2a04a8 Stop relying on device-type.json for resolving the device type aliases
Resolves: #2541
Change-type: patch
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
2022-10-17 19:09:09 +03:00
57b0dccc7d Stop relying on device-type.json for resolving the cpu architecture
Resolves: #2542
Change-type: patch
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
2022-10-17 19:09:09 +03:00
d1e3bdf29a keeps events loggiging with default message
change-type: minor
2022-10-17 10:07:51 -03:00
bdf7fedd7a uses amplitude data events format
Change-type: minor
2022-10-14 10:50:12 -03:00
c163662f4a changes analytics endpoint to analytics-backend
change-type: minor
2022-10-13 19:32:55 -03:00
25 changed files with 1544 additions and 209 deletions

131
.github/actions/publish/action.yml vendored Normal file
View File

@ -0,0 +1,131 @@
---
name: package and draft 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
# --- custom environment
XCODE_APP_LOADER_EMAIL:
type: string
default: "accounts+apple@balena.io"
NODE_VERSION:
type: string
# FIXME: (please) https://github.com/balena-io/balena-cli/issues/2165
default: "12.x"
VERBOSE:
type: string
default: "true"
runs:
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
using: "composite"
steps:
- name: Download custom source artifact
uses: actions/download-artifact@v3
with:
name: custom-${{ github.event.pull_request.head.sha || github.event.head_commit.id }}-${{ runner.os }}
path: ${{ runner.temp }}
- name: Extract custom source artifact
shell: pwsh
working-directory: .
run: tar -xf ${{ runner.temp }}/custom.tgz
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.NODE_VERSION }}
cache: npm
- name: Install additional tools
if: runner.os == 'Windows'
shell: bash
run: |
choco install yq
- name: Install additional tools
if: runner.os == 'macOS'
shell: bash
run: |
brew install coreutils
# https://www.electron.build/code-signing.html
# https://github.com/Apple-Actions/import-codesign-certs
- name: Import Apple code signing certificate
if: runner.os == 'macOS'
uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ fromJSON(inputs.secrets).APPLE_SIGNING }}
p12-password: ${{ fromJSON(inputs.secrets).APPLE_SIGNING_PASSWORD }}
- name: Import Windows code signing certificate
if: runner.os == 'Windows'
shell: powershell
run: |
Set-Content -Path ${{ runner.temp }}/certificate.base64 -Value $env:WINDOWS_CERTIFICATE
certutil -decode ${{ runner.temp }}/certificate.base64 ${{ runner.temp }}/certificate.pfx
Remove-Item -path ${{ runner.temp }} -include certificate.base64
Import-PfxCertificate `
-FilePath ${{ runner.temp }}/certificate.pfx `
-CertStoreLocation Cert:\CurrentUser\My `
-Password (ConvertTo-SecureString -String $env:WINDOWS_CERTIFICATE_PASSWORD -Force -AsPlainText)
env:
WINDOWS_CERTIFICATE: ${{ fromJSON(inputs.secrets).WINDOWS_SIGNING }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ fromJSON(inputs.secrets).WINDOWS_SIGNING_PASSWORD }}
# 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
shell: bash
run: |
set -ea
[[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x
runner_os="$(echo "${RUNNER_OS}" | tr '[:upper:]' '[:lower:]')"
runner_arch="$(echo "${RUNNER_ARCH}" | tr '[:upper:]' '[:lower:]')"
if [[ $runner_os =~ darwin|macos|osx ]]; then
CSC_KEY_PASSWORD=${{ fromJSON(inputs.secrets).APPLE_SIGNING_PASSWORD }}
CSC_KEYCHAIN=signing_temp
CSC_LINK=${{ fromJSON(inputs.secrets).APPLE_SIGNING }}
elif [[ $runner_os =~ windows|win ]]; then
CSC_KEY_PASSWORD=${{ fromJSON(inputs.secrets).WINDOWS_SIGNING_PASSWORD }}
CSC_LINK='${{ runner.temp }}\certificate.pfx'
# patches/all/oclif.patch
MSYSSHELLPATH="$(which bash)"
MSYSTEM=MSYS
# (signtool.exe) https://github.com/actions/runner-images/blob/main/images/win/Windows2019-Readme.md#installed-windows-sdks
PATH="/c/Program Files (x86)/Windows Kits/10/bin/${runner_arch}:${PATH}"
fi
npm run package
find dist -type f -maxdepth 1
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
CSC_FOR_PULL_REQUEST: true
# https://sectigo.com/resource-library/time-stamping-server
TIMESTAMP_SERVER: http://timestamp.sectigo.com
# Apple notarization (automation/build-bin.ts)
XCODE_APP_LOADER_EMAIL: ${{ inputs.XCODE_APP_LOADER_EMAIL }}
XCODE_APP_LOADER_PASSWORD: ${{ fromJSON(inputs.secrets).XCODE_APP_LOADER_PASSWORD }}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: gh-release-${{ github.event.pull_request.head.sha || github.event.head_commit.id }}
path: dist
retention-days: 1

57
.github/actions/test/action.yml vendored Normal file
View File

@ -0,0 +1,57 @@
---
name: test 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
# --- custom environment
NODE_VERSION:
type: string
# FIXME: (please) https://github.com/balena-io/balena-cli/issues/2165
default: "12.x"
VERBOSE:
type: string
default: "true"
runs:
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
using: "composite"
steps:
# https://github.com/actions/setup-node#caching-global-packages-data
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.NODE_VERSION }}
cache: npm
- name: Test release
shell: bash
run: |
set -ea
[[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x
if [[ -e package-lock.json ]]; then
npm ci
else
npm i
fi
npm run build
npm run test
- name: Compress custom source
shell: pwsh
run: tar -acf ${{ runner.temp }}/custom.tgz .
- name: Upload custom artifact
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
retention-days: 1

16
.github/workflows/flowzone.yml vendored Normal file
View File

@ -0,0 +1,16 @@
name: Flowzone
on:
pull_request:
types: [opened, synchronize, closed]
branches:
- "main"
- "master"
jobs:
flowzone:
name: Flowzone
uses: product-os/flowzone/.github/workflows/flowzone.yml@master
secrets: inherit
with:
tests_run_on: '["ubuntu-20.04","macos-11","windows-2019"]'

1
.gitignore vendored
View File

@ -10,7 +10,6 @@
*.seed
/.idea/
/.lock-wscript
/.nvmrc
/.nyc_output/
/.vscode/
/coverage/

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
12

View File

@ -1,20 +0,0 @@
---
npm:
platforms:
- name: linux
os: ubuntu
architecture: x86_64
node_versions:
- "12"
- "14"
##
## Temporarily skip Alpine tests until the following issues are resolved:
## * https://github.com/concourse/concourse/issues/7905
## * https://github.com/product-os/balena-concourse/issues/631
##
# - name: linux
# os: alpine
# architecture: x86_64
# node_versions:
# - "12"
# - "14"

View File

@ -1,3 +1,307 @@
- 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
body: ""
footer:
Change-type: patch
change-type: patch
author: ab77
nested: []
version: 14.5.3
title: ""
date: 2022-11-10T17:20:17.608Z
- commits:
- subject: Stop waiting for the analytics response
hash: 1c7d9255ae5333ff717b9f32ef7adf1690cbb163
body: ""
footer:
Change-type: patch
change-type: patch
See: https://balena.zulipchat.com/#narrow/stream/345884-aspect.2Fanalytics/topic/Balena.20CLI.20analytics-performance
see: https://balena.zulipchat.com/#narrow/stream/345884-aspect.2Fanalytics/topic/Balena.20CLI.20analytics-performance
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
signed-off-by: Thodoris Greasidis <thodoris@balena.io>
author: Thodoris Greasidis
nested: []
version: 14.5.2
title: "'Stop waiting for the analytics response'"
date: 2022-10-21T16:18:42.222Z
- commits:
- subject: Bump parse-link-header from 1.0.1 to 2.0.0
hash: 3c2c925eed81ed61e1326437038cda1059b1a0ba
body: >
Bumps [parse-link-header](https://github.com/thlorenz/parse-link-header)
from 1.0.1 to 2.0.0.
- [Release notes](https://github.com/thlorenz/parse-link-header/releases)
- [Commits](https://github.com/thlorenz/parse-link-header/compare/v1.0.1...v2.0.0)
---
updated-dependencies:
- dependency-name: parse-link-header
dependency-type: direct:development
...
footer:
Change-type: patch
change-type: patch
Signed-off-by: dependabot[bot] <support@github.com>
signed-off-by: dependabot[bot] <support@github.com>
author: dependabot[bot]
nested: []
version: 14.5.1
title: "'Bump parse-link-header from 1.0.1 to 2.0.0'"
date: 2022-10-20T17:14:00.057Z
- commits:
- subject: keeps events loggiging with default message
hash: d1e3bdf29a4cbe976f6d2feff0eb0f8553b3865a
body: ""
footer:
change-type: minor
author: Otávio Jacobi
nested: []
- subject: uses amplitude data events format
hash: bdf7fedd7aa596834243590cf914f8f366088867
body: ""
footer:
Change-type: minor
change-type: minor
author: Otávio Jacobi
nested: []
- subject: changes analytics endpoint to analytics-backend
hash: c163662f4a63e1a3b0621ef28c8720f6f4a1edcd
body: ""
footer:
change-type: minor
author: Otávio Jacobi
nested: []
version: 14.5.0
title: "'changes analytics endpoint to analytics-backend'"
date: 2022-10-18T11:18:18.257Z
- commits:
- subject: Update simple-git to 3.14.1
hash: 70330759007bfdba81986e6c7db1f5c2cb0d7d5f
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.4.4
title: "'Update simple git'"
date: 2022-10-18T10:00:35.080Z
- commits:
- subject: "config generate: Fix the incompatible arch errors showing as not found"
hash: 2e115968d5dce98fe05ab0607e1c04bd9f4c67c8
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.4.3
title: "'config generate: Fix the incompatible arch errors showing as not found'"
date: 2022-10-17T20:46:59.653Z
- commits:
- subject: Stop relying on device-type.json for resolving the device type aliases
hash: a20d2a04a86797d77819c63e556d8ec7d4c128ca
body: ""
footer:
Resolves: "#2541"
resolves: "#2541"
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: []
- subject: Stop relying on device-type.json for resolving the cpu architecture
hash: 57b0dccc7d12197dc78c2b8fd4f3cdb6329ec510
body: ""
footer:
Resolves: "#2542"
resolves: "#2542"
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.4.2
title: "'Stop relying on device-type.json for resolving the cpu architecture'"
date: 2022-10-17T16:15:07.388Z
- commits:
- subject: "balena os initialize: Clarify that the process includes flashing"
hash: e46902e6839eeb2f59f445aeef94500bd34b8c14
@ -843,8 +1147,8 @@
- subject: "patch: bump browserify from 14.5.0 to 17.0.0"
hash: 2ee532e8dcc3eda0c54296f468f7f9a9e637071a
body: >
Bumps [browserify](https://github.com/browserify/browserify)
from 14.5.0 to 17.0.0.
Bumps [browserify](https://github.com/browserify/browserify) from 14.5.0
to 17.0.0.
- [Release notes](https://github.com/browserify/browserify/releases)
@ -873,8 +1177,7 @@
- subject: "patch: bump tmp from 0.0.31 to 0.2.1"
hash: e905a6a8054297c89e75447e5ff48ca92e13bd49
body: >
Bumps [tmp](https://github.com/raszi/node-tmp) from 0.0.31 to
0.2.1.
Bumps [tmp](https://github.com/raszi/node-tmp) from 0.0.31 to 0.2.1.
- [Release notes](https://github.com/raszi/node-tmp/releases)
@ -957,8 +1260,7 @@
- subject: "patch: bump mocha from 3.5.3 to 10.0.0"
hash: 548996665b7e6159e5e209aa4a10987e071da024
body: >
Bumps [mocha](https://github.com/mochajs/mocha) from 3.5.3 to
10.0.0.
Bumps [mocha](https://github.com/mochajs/mocha) from 3.5.3 to 10.0.0.
- [Release notes](https://github.com/mochajs/mocha/releases)
@ -1001,8 +1303,8 @@
- subject: "patch: bump mockttp from 0.9.1 to 2.7.0"
hash: fa44187e4e510171666f046d6a3a658f59956fd4
body: >-
Bumps [mockttp](https://github.com/httptoolkit/mockttp) from
0.9.1 to 2.7.0.
Bumps [mockttp](https://github.com/httptoolkit/mockttp) from 0.9.1 to
2.7.0.
- [Release notes](https://github.com/httptoolkit/mockttp/releases)
@ -1075,8 +1377,8 @@
- subject: "patch: bump superagent from 3.8.3 to 7.1.2"
hash: ae3974af1965386bf236b7ae295e4a9ecc285f0c
body: >
Bumps [superagent](https://github.com/visionmedia/superagent)
from 3.8.3 to 7.1.2.
Bumps [superagent](https://github.com/visionmedia/superagent) from 3.8.3
to 7.1.2.
- [Release notes](https://github.com/visionmedia/superagent/releases)
@ -1105,8 +1407,7 @@
- subject: "patch: bump dotenv from 4.0.0 to 16.0.0"
hash: b2ddda64df84d5a109b2adc1ee847ff5aef17000
body: >
Bumps [dotenv](https://github.com/motdotla/dotenv) from 4.0.0 to
16.0.0.
Bumps [dotenv](https://github.com/motdotla/dotenv) from 4.0.0 to 16.0.0.
- [Release notes](https://github.com/motdotla/dotenv/releases)
@ -1245,8 +1546,8 @@
- subject: "minor: Add trying SDK in the browser"
hash: 50a6ca1844869eaccaf3275361a4016f7a284c05
body: >
Add information about using SDK in the browser as a partial.
Solving: https://github.com/balena-io/docs/issues/2205
Add information about using SDK in the browser as a partial. Solving:
https://github.com/balena-io/docs/issues/2205
footer:
Signed-off-by: Vipul Gupta (@vipulgupta2048) <vipul@balena.io>
signed-off-by: Vipul Gupta (@vipulgupta2048) <vipul@balena.io>
@ -1333,8 +1634,7 @@
- subject: Remove unnecessary vpn address filtering when fetching local addresses
hash: 12266a3c9349e5d944ba203e56f2fe80b5e97970
body: >
This has been handled by the supervisor since v2.2.0 / balenaOS
v1.14
This has been handled by the supervisor since v2.2.0 / balenaOS v1.14
from 2016-09-23 and is not relevant for any supported devices
footer:
@ -1704,8 +2004,8 @@
- subject: Add support for building images with progress
hash: e072408ee951d3caf46af5050d0b71991d114614
body: >
Using build instead of pull allows to add metadata (e.g. labels)
to pulled images in an
Using build instead of pull allows to add metadata (e.g. labels) to pulled
images in an
atomic way. This commit adds the `DockerProgres.build()` method to
@ -2794,8 +3094,7 @@
- subject: Allow more lenient gzip decompression
hash: 9c7bc3051b279c9d09ec501a78dbe9f506d65650
body: >
Be more lenient with decoding compressed
responses, since (very rarely)
Be more lenient with decoding compressed responses, since (very rarely)
servers send slightly invalid gzip responses that are still accepted
@ -4468,8 +4767,8 @@
- subject: Improve directory scan speed prior to tarballing
hash: 257dd514ed7c0f6988b8a47219991cc4f61b4529
body: >
This changes improves the speed that the project is tarballed by
switching from
This changes improves the speed that the project is tarballed by switching
from
`klaw` to `recursive-fs` and not running `lstat` on files that are ignored.
@ -4980,8 +5279,7 @@
- subject: Allow more lenient gzip decompression
hash: 9c7bc3051b279c9d09ec501a78dbe9f506d65650
body: >
Be more lenient with decoding compressed responses,
since (very rarely)
Be more lenient with decoding compressed responses, since (very rarely)
servers send slightly invalid gzip responses that are still accepted
@ -5279,8 +5577,7 @@
- subject: Add balena.yml handling and `--draft` to `balena deploy` release creation
hash: 7d568a928b4297671e3776b72f64a6e2845d5f72
body: >
This change allows use of a contract and release semver when doing a
push,
This change allows use of a contract and release semver when doing a push,
and is part of the larger feature to use the builder as part of a CI/CD pipeline.
footer:
@ -6650,8 +6947,7 @@
- subject: "docker: Improve handling of Docker-in-Docker errors"
hash: 9036ce9af373eb8d328f105839163db0cae38ae6
body: >
The `local` logging driver captures output from containers
stdout/stderr
The `local` logging driver captures output from containers stdout/stderr
and writes them to an internal storage that is optimized for performance and disk use.
@ -10310,8 +10606,7 @@
- commits:
- author: Thodoris Greasidis
body: >-
Didn't convert the source, so that we don't end
up
Didn't convert the source, so that we don't end up
having conflicts with other ongoing PRs.
footers:
@ -17937,8 +18232,7 @@
subject: "dependencies: bump etcher-sdk to pull in fixes"
- author: Gergely Imreh
body: >-
To fix the same error as here
https://github.com/nodejs/node/issues/20285
To fix the same error as here https://github.com/nodejs/node/issues/20285
Task changes as described at https://fettblog.eu/gulp-4-parallel-and-series/
footers:
@ -19481,11 +19775,11 @@
subject: Improve `selectFromList` function signature to be much more reusable
- author: Akis Kesoglou
body: >-
Both commands work with local devices by remotely invoking the
`os-config` executable via SSH. This requires an as of yet unreleased
resinOS (that will most likely be v2.14) and the commands ascertain
compatibility merely by looking for the `os-config` executable in the
device, and bail out if its not present.
Both commands work with local devices by remotely invoking the `os-config`
executable via SSH. This requires an as of yet unreleased resinOS (that
will most likely be v2.14) and the commands ascertain compatibility
merely by looking for the `os-config` executable in the device, and bail
out if its not present.
`join` and `leave` accept a couple of optional arguments and implement a wizard-style interface if these are not given. They allow to interactively select the device and the application to promote to. If the user has no apps, `join` will offer the user to create one. `join` will also offer the user to login or create an account if theyre not logged in already without exiting the wizard.
@ -20151,9 +20445,9 @@
subject: Fix invoking undefined method
- author: Akis Kesoglou
body: >-
Legacy behaviour is mostly retained. The most notable change in
behaviour is that invoking `resin deploy` without options is now allowed
(see help string how it behaves).
Legacy behaviour is mostly retained. The most notable change in behaviour
is that invoking `resin deploy` without options is now allowed (see help
string how it behaves).
In this commit there are also the following notable changes:

View File

@ -4,6 +4,86 @@ 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]
## 14.5.2 - 2022-10-21
* Stop waiting for the analytics response [Thodoris Greasidis]
## 14.5.1 - 2022-10-20
* Bump parse-link-header from 1.0.1 to 2.0.0 [dependabot[bot]]
## 14.5.0 - 2022-10-18
* keeps events loggiging with default message [Otávio Jacobi]
* uses amplitude data events format [Otávio Jacobi]
* changes analytics endpoint to analytics-backend [Otávio Jacobi]
## 14.4.4 - 2022-10-18
* Update simple-git to 3.14.1 [Thodoris Greasidis]
## 14.4.3 - 2022-10-17
* config generate: Fix the incompatible arch errors showing as not found [Thodoris Greasidis]
## 14.4.2 - 2022-10-17
* Stop relying on device-type.json for resolving the device type aliases [Thodoris Greasidis]
* Stop relying on device-type.json for resolving the cpu architecture [Thodoris Greasidis]
## 14.4.1 - 2022-10-12
* balena os initialize: Clarify that the process includes flashing [Heath Raftery]

View File

@ -45,8 +45,6 @@ const execFileAsync = promisify(execFile);
export const packageJSON = loadPackageJson();
export const version = 'v' + packageJSON.version;
const arch = process.arch;
const MSYS2_BASH =
process.env.MSYSSHELLPATH || 'C:\\msys64\\usr\\bin\\bash.exe';
function dPath(...paths: string[]) {
return path.join(ROOT, 'dist', ...paths);
@ -425,20 +423,28 @@ async function renameInstallerFiles() {
/**
* If the CSC_LINK and CSC_KEY_PASSWORD env vars are set, digitally sign the
* executable installer by running the balena-io/scripts/shared/sign-exe.sh
* script (which must be in the PATH) using a MSYS2 bash shell.
* executable installer using Microsoft SignTool.exe (Sign Tool)
* https://learn.microsoft.com/en-us/dotnet/framework/tools/signtool-exe
*/
async function signWindowsInstaller() {
if (process.env.CSC_LINK && process.env.CSC_KEY_PASSWORD) {
const exeName = renamedOclifInstallers[process.platform];
console.log(`Signing installer "${exeName}"`);
await execFileAsync(MSYS2_BASH, [
'sign-exe.sh',
// trust ...
await execFileAsync('signtool.exe', [
'sign',
'-t',
process.env.TIMESTAMP_SERVER || 'http://timestamp.comodoca.com',
'-f',
exeName,
process.env.CSC_LINK,
'-p',
process.env.CSC_KEY_PASSWORD,
'-d',
`balena-cli ${version}`,
exeName,
]);
// ... but verify
await execFileAsync('signtool.exe', ['verify', '-pa', '-v', exeName]);
} else {
console.log(
'Skipping installer signing step because CSC_* env vars are not set',
@ -450,14 +456,21 @@ async function signWindowsInstaller() {
* Wait for Apple Installer Notarization to continue
*/
async function notarizeMacInstaller(): Promise<void> {
const appleId = 'accounts+apple@balena.io';
const { notarize } = await import('electron-notarize');
await notarize({
appBundleId: 'io.balena.etcher',
appPath: renamedOclifInstallers.darwin,
appleId,
appleIdPassword: '@keychain:CLI_PASSWORD',
});
const appleId =
process.env.XCODE_APP_LOADER_EMAIL || 'accounts+apple@balena.io';
const appBundleId = packageJSON.oclif.macos.identifier || 'io.balena.cli';
const appleIdPassword = process.env.XCODE_APP_LOADER_PASSWORD;
if (appleIdPassword) {
const { notarize } = await import('electron-notarize');
// https://github.com/electron/notarize/blob/main/README.md
await notarize({
appBundleId,
appPath: renamedOclifInstallers.darwin,
appleId,
appleIdPassword,
});
}
}
/**

View File

@ -15,11 +15,12 @@
* limitations under the License.
*/
const stripIndent = require('common-tags/lib/stripIndent');
const _ = require('lodash');
const { promises: fs } = require('fs');
const path = require('path');
const simplegit = require('simple-git/promise');
// tslint:disable-next-line:import-blacklist
import { stripIndent } from 'common-tags';
import * as _ from 'lodash';
import { promises as fs } from 'fs';
import * as path from 'path';
import { simpleGit } from 'simple-git';
const ROOT = path.normalize(path.join(__dirname, '..'));
@ -31,7 +32,7 @@ const ROOT = path.normalize(path.join(__dirname, '..'));
* using `touch`.
*/
async function checkBuildTimestamps() {
const git = simplegit(ROOT);
const git = simpleGit(ROOT);
const docFile = path.join(ROOT, 'docs', 'balena-cli.md');
const [docStat, gitStatus] = await Promise.all([
fs.stat(docFile),
@ -81,4 +82,5 @@ async function run() {
}
}
// tslint:disable-next-line:no-floating-promises
run();

View File

@ -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 )

View File

@ -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"

View File

@ -175,26 +175,26 @@ export default class ConfigGenerateCmd extends Command {
const deviceType = options.deviceType || resourceDeviceType;
const deviceManifest = await balena.models.device.getManifestBySlug(
deviceType,
);
// Check compatibility if application and deviceType provided
if (options.fleet && options.deviceType) {
const appDeviceManifest = await balena.models.device.getManifestBySlug(
resourceDeviceType,
);
const helpers = await import('../../utils/helpers');
if (
!helpers.areDeviceTypesCompatible(appDeviceManifest, deviceManifest)
!(await helpers.areDeviceTypesCompatible(
resourceDeviceType,
deviceType,
))
) {
throw new balena.errors.BalenaInvalidDeviceType(
const { ExpectedError } = await import('../../errors');
throw new ExpectedError(
`Device type ${options.deviceType} is incompatible with fleet ${options.fleet}`,
);
}
}
const deviceManifest = await balena.models.device.getManifestBySlug(
deviceType,
);
// Prompt for values
// Pass params as an override: if there is any param with exactly the same name as a
// required option, that value is used (and the corresponding question is not asked)

View 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;
}
}
}

View File

@ -15,6 +15,7 @@
* limitations under the License.
*/
import { flags } from '@oclif/command';
import type * as BalenaSdk from 'balena-sdk';
import * as _ from 'lodash';
import Command from '../../command';
@ -59,36 +60,38 @@ export default class DevicesSupportedCmd extends Command {
public async run() {
const { flags: options } = this.parse<FlagsDef, {}>(DevicesSupportedCmd);
const [dts, configDTs] = await Promise.all([
getBalenaSdk().models.deviceType.getAllSupported({
$expand: { is_of__cpu_architecture: { $select: 'slug' } },
$select: ['slug', 'name'],
}),
getBalenaSdk().models.config.getDeviceTypes(),
]);
const dtsBySlug = _.keyBy(dts, (dt) => dt.slug);
const configDTsBySlug = _.keyBy(configDTs, (dt) => dt.slug);
const pineOptions = {
$select: (['slug', 'name'] as const).slice(),
$expand: {
is_of__cpu_architecture: { $select: 'slug' },
device_type_alias: {
$select: 'is_referenced_by__alias',
$orderby: 'is_referenced_by__alias asc',
},
},
} as const;
const dts = (await getBalenaSdk().models.deviceType.getAllSupported(
pineOptions,
)) as Array<
BalenaSdk.PineTypedResult<BalenaSdk.DeviceType, typeof pineOptions>
>;
interface DT {
slug: string;
aliases: string[];
arch: string;
name: string;
}
let deviceTypes: DT[] = [];
for (const slug of Object.keys(dtsBySlug)) {
const configDT: Partial<typeof configDTs[0]> =
configDTsBySlug[slug] || {};
const aliases = (configDT.aliases || []).filter(
(alias) => alias !== slug,
);
const dt: Partial<typeof dts[0]> = dtsBySlug[slug] || {};
deviceTypes.push({
slug,
let deviceTypes = dts.map((dt): DT => {
const aliases = dt.device_type_alias
.map((dta) => dta.is_referenced_by__alias)
.filter((alias) => alias !== dt.slug);
return {
slug: dt.slug,
aliases: options.json ? aliases : [aliases.join(', ')],
arch: (dt.is_of__cpu_architecture as any)?.[0]?.slug || 'n/a',
arch: dt.is_of__cpu_architecture[0]?.slug || 'n/a',
name: dt.name || 'N/A',
});
}
};
});
const fields = ['slug', 'aliases', 'arch', 'name'];
deviceTypes = _.sortBy(deviceTypes, fields);
if (options.json) {

View File

@ -215,7 +215,7 @@ export default class OsConfigureCmd extends Command {
is_for__device_type: { $select: 'slug' },
},
})) as ApplicationWithDeviceType;
await checkDeviceTypeCompatibility(balena, options, app);
await checkDeviceTypeCompatibility(options, app);
deviceTypeSlug =
options['device-type'] || app.is_for__device_type[0].slug;
}
@ -361,17 +361,17 @@ async function getOsVersionFromImage(
* @param app Balena SDK Application model object
*/
async function checkDeviceTypeCompatibility(
sdk: BalenaSdk.BalenaSDK,
options: FlagsDef,
app: ApplicationWithDeviceType,
) {
if (options['device-type']) {
const [appDeviceType, optionDeviceType] = await Promise.all([
sdk.models.device.getManifestBySlug(app.is_for__device_type[0].slug),
sdk.models.device.getManifestBySlug(options['device-type']),
]);
const helpers = await import('../../utils/helpers');
if (!helpers.areDeviceTypesCompatible(appDeviceType, optionDeviceType)) {
if (
!(await helpers.areDeviceTypesCompatible(
app.is_for__device_type[0].slug,
options['device-type'],
))
) {
throw new ExpectedError(
`Device type ${options['device-type']} is incompatible with fleet ${options.fleet}`,
);

View File

@ -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?

View File

@ -73,38 +73,52 @@ export async function trackCommand(commandSignature: string) {
}
}
const TIMEOUT = 4000;
/**
* Make the event tracking HTTPS request to balenaCloud's '/mixpanel' endpoint.
*/
async function sendEvent(balenaUrl: string, event: string, username?: string) {
const { default: got } = await import('got');
const trackData = {
event,
properties: {
arch: process.arch,
balenaUrl, // e.g. 'balena-cloud.com' or 'balena-staging.com'
distinct_id: username,
mp_lib: 'node',
node: process.version,
platform: process.platform,
token: 'balena-main',
version: packageJSON.version,
},
};
const url = `https://api.${balenaUrl}/mixpanel/track`;
const searchParams = {
ip: 0,
verbose: 0,
data: Buffer.from(JSON.stringify(trackData)).toString('base64'),
api_key: 'balena-main',
events: [
{
event_type: event,
user_id: username,
version_name: packageJSON.version,
event_properties: {
balenaUrl, // e.g. 'balena-cloud.com' or 'balena-staging.com'
arch: process.arch,
platform: process.platform,
node: process.version,
},
},
],
};
const url = `https://data.${balenaUrl}/amplitude/2/httpapi`;
try {
await got(url, { searchParams, retry: 0, timeout: 4000 });
await got.post(url, {
json: trackData,
retry: 0,
timeout: {
// Starts when the request is initiated.
request: TIMEOUT,
// Starts when request has been flushed.
// Exits the request as soon as it's sent.
response: 0,
},
});
} catch (e) {
if (process.env.DEBUG) {
console.error(`[debug] Event tracking error: ${e.message || e}`);
}
if (e instanceof got.TimeoutError) {
if (
e instanceof got.TimeoutError &&
TIMEOUT < (e.timings.phases.total ?? 0)
) {
console.error(stripIndent`
Timeout submitting analytics event to balenaCloud/openBalena.
If you are using the balena CLI in an air-gapped environment with a filtered

View File

@ -107,16 +107,6 @@ export const getDeviceAndMaybeAppFromUUID = _.memoize(
(_sdk, deviceUUID) => deviceUUID,
);
/** Given a device type alias like 'nuc', return the actual slug like 'intel-nuc'. */
export const unaliasDeviceType = _.memoize(async function (
sdk: SDK.BalenaSDK,
deviceType: string,
): Promise<string> {
return (
(await sdk.models.device.getManifestBySlug(deviceType)).slug || deviceType
);
});
/**
* Download balenaOS image for the specified `deviceType`.
* `OSVersion` may be one of:
@ -255,8 +245,8 @@ export async function getOsVersions(
);
// if slug is an alias, fetch the real slug
if (!versions.length) {
// unaliasDeviceType() produces a nice error msg if slug is invalid
slug = await unaliasDeviceType(sdk, slug);
// unalias device type slug
slug = (await sdk.models.deviceType.get(slug, { $select: 'slug' })).slug;
if (slug !== deviceType) {
versions = await sdk.models.os.getAvailableOsVersions(slug);
}

View File

@ -107,21 +107,50 @@ 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 = (
appDeviceType: BalenaSdk.DeviceTypeJson.DeviceType,
osDeviceType: BalenaSdk.DeviceTypeJson.DeviceType,
) =>
getBalenaSdk().models.os.isArchitectureCompatibleWith(
osDeviceType.arch,
appDeviceType.arch,
) && !!appDeviceType.isDependent === !!osDeviceType.isDependent;
export const areDeviceTypesCompatible = async (
appDeviceTypeSlug: string,
osDeviceTypeSlug: string,
) => {
if (appDeviceTypeSlug === osDeviceTypeSlug) {
return true;
}
const sdk = getBalenaSdk();
const pineOptions = {
$select: 'is_of__cpu_architecture',
$expand: {
is_of__cpu_architecture: {
$select: 'slug',
},
},
} as const;
const [appDeviceType, osDeviceType] = await Promise.all(
[appDeviceTypeSlug, osDeviceTypeSlug].map(
(dtSlug) =>
sdk.models.deviceType.get(dtSlug, pineOptions) as Promise<
BalenaSdk.PineTypedResult<BalenaSdk.DeviceType, typeof pineOptions>
>,
),
);
return sdk.models.os.isArchitectureCompatibleWith(
osDeviceType.is_of__cpu_architecture[0].slug,
appDeviceType.is_of__cpu_architecture[0].slug,
);
};
export async function osProgressHandler(step: InitializeEmitter) {
step.on('stdout', process.stdout.write.bind(process.stdout));

View File

@ -198,31 +198,37 @@ async function selectAppFromList(
async function getOrSelectApplication(
sdk: BalenaSdk.BalenaSDK,
deviceType: string,
deviceTypeSlug: string,
appName?: string,
): Promise<ApplicationWithDeviceType> {
const _ = await import('lodash');
const pineOptions = {
$select: 'slug',
$expand: {
is_of__cpu_architecture: {
$select: 'slug',
},
},
} as const;
const [deviceType, allDeviceTypes] = await Promise.all([
sdk.models.deviceType.get(deviceTypeSlug, pineOptions) as Promise<
BalenaSdk.PineTypedResult<BalenaSdk.DeviceType, typeof pineOptions>
>,
sdk.models.deviceType.getAllSupported(pineOptions) as Promise<
Array<BalenaSdk.PineTypedResult<BalenaSdk.DeviceType, typeof pineOptions>>
>,
]);
const allDeviceTypes = await sdk.models.config.getDeviceTypes();
const deviceTypeManifest = _.find(allDeviceTypes, { slug: deviceType });
if (!deviceTypeManifest) {
throw new ExpectedError(`"${deviceType}" is not a valid device type`);
}
const compatibleDeviceTypes = _(allDeviceTypes)
.filter(
(dt) =>
sdk.models.os.isArchitectureCompatibleWith(
deviceTypeManifest.arch,
dt.arch,
) &&
!!dt.isDependent === !!deviceTypeManifest.isDependent &&
dt.state !== 'DISCONTINUED',
const compatibleDeviceTypes = allDeviceTypes
.filter((dt) =>
sdk.models.os.isArchitectureCompatibleWith(
deviceType.is_of__cpu_architecture[0].slug,
dt.is_of__cpu_architecture[0].slug,
),
)
.map((type) => type.slug)
.value();
.map((type) => type.slug);
if (!appName) {
return createOrSelectApp(sdk, compatibleDeviceTypes, deviceType);
return createOrSelectApp(sdk, compatibleDeviceTypes, deviceTypeSlug);
}
const options: BalenaSdk.PineOptions<BalenaSdk.Application> = {
@ -257,13 +263,13 @@ async function getOrSelectApplication(
undefined,
true,
);
return await createApplication(sdk, deviceType, name);
return await createApplication(sdk, deviceTypeSlug, name);
}
// We've found at least one fleet with the given name.
// Filter out fleets for non-matching device types and see what we're left with.
const validApplications = applications.filter((app) =>
_.includes(compatibleDeviceTypes, app.is_for__device_type[0].slug),
compatibleDeviceTypes.includes(app.is_for__device_type[0].slug),
);
if (validApplications.length === 0) {

24
npm-shrinkwrap.json generated
View File

@ -1,6 +1,6 @@
{
"name": "balena-cli",
"version": "14.4.1",
"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",
@ -12889,9 +12889,9 @@
}
},
"parse-link-header": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/parse-link-header/-/parse-link-header-1.0.1.tgz",
"integrity": "sha1-vt/g0hGK64S+deewJUGeyKYRQKc=",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/parse-link-header/-/parse-link-header-2.0.0.tgz",
"integrity": "sha512-xjU87V0VyHZybn2RrCX5TIFGxTVZE6zqqZWMPlIKiSKuWh/X5WZdt+w1Ki1nXB+8L/KtL+nZ4iq+sfI6MrhhMw==",
"dev": true,
"requires": {
"xtend": "~4.0.1"
@ -15164,20 +15164,20 @@
}
},
"simple-git": {
"version": "2.48.0",
"resolved": "https://registry.npmjs.org/simple-git/-/simple-git-2.48.0.tgz",
"integrity": "sha512-z4qtrRuaAFJS4PUd0g+xy7aN4y+RvEt/QTJpR184lhJguBA1S/LsVlvE/CM95RsYMOFJG3NGGDjqFCzKU19S/A==",
"version": "3.14.1",
"resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.14.1.tgz",
"integrity": "sha512-1ThF4PamK9wBORVGMK9HK5si4zoGS2GpRO7tkAFObA4FZv6dKaCVHLQT+8zlgiBm6K2h+wEU9yOaFCu/SR3OyA==",
"dev": true,
"requires": {
"@kwsites/file-exists": "^1.1.1",
"@kwsites/promise-deferred": "^1.1.1",
"debug": "^4.3.2"
"debug": "^4.3.4"
},
"dependencies": {
"debug": {
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz",
"integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==",
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"dev": true,
"requires": {
"ms": "2.1.2"

View File

@ -1,6 +1,6 @@
{
"name": "balena-cli",
"version": "14.4.1",
"version": "14.5.15",
"description": "The official balena Command Line Interface",
"main": "./build/app.js",
"homepage": "https://github.com/balena-io/balena-cli",
@ -90,12 +90,11 @@
"author": "Balena Inc. (https://balena.io/)",
"license": "Apache-2.0",
"engines": {
"node": ">=12.8.0 <13.0.0",
"npm": "<7.0.0"
"node": ">=12 <16"
},
"husky": {
"hooks": {
"pre-commit": "node automation/check-npm-version.js && node automation/check-doc.js"
"pre-commit": "node automation/check-npm-version.js && ts-node automation/check-doc.ts"
}
},
"oclif": {
@ -184,11 +183,11 @@
"mocha": "^8.4.0",
"mock-require": "^3.0.3",
"nock": "^13.2.1",
"parse-link-header": "^1.0.1",
"parse-link-header": "^2.0.0",
"pkg": "^5.5.1",
"publish-release": "^1.6.1",
"rewire": "^5.0.0",
"simple-git": "^2.48.0",
"simple-git": "^3.14.1",
"sinon": "^11.1.2",
"ts-node": "^10.4.0",
"typescript": "^4.6.4"
@ -208,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",
@ -285,6 +284,6 @@
"windosu": "^0.3.0"
},
"versionist": {
"publishedAt": "2022-10-12T13:55:51.707Z"
"publishedAt": "2022-12-12T13:41:12.779Z"
}
}

View File

@ -44,7 +44,6 @@ describe('balena devices supported', function () {
it('should list currently supported devices, with correct filtering', async () => {
api.expectGetDeviceTypes();
api.expectGetConfigDeviceTypes();
const { out, err } = await runCommand('devices supported');
@ -54,7 +53,7 @@ describe('balena devices supported', function () {
expect(lines).to.have.lengthOf.at.least(2);
expect(lines).to.contain('intel-nuc nuc amd64 Intel NUC');
expect(lines).to.contain(
'odroid-xu4 odroid-ux3, odroid-u3+ armv7hf ODROID-XU4',
'odroid-xu4 odroid-u3+, odroid-ux3 armv7hf ODROID-XU4',
);
expect(err).to.eql([]);
});

File diff suppressed because it is too large Load Diff