mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-06-24 10:35:39 +00:00
Compare commits
36 Commits
Author | SHA1 | Date | |
---|---|---|---|
97b8c75043 | |||
7cb8349f29 | |||
6063f4c776 | |||
4899d545f1 | |||
115bf6433d | |||
e5ce1ade89 | |||
9c4174ea8a | |||
cf16957195 | |||
4de369ff95 | |||
ac3ebff8ee | |||
76b01d92d3 | |||
19144163ee | |||
535ffccbad | |||
6f5ada9692 | |||
1c7d9255ae | |||
807e6ea2ad | |||
c76f019fd0 | |||
3c2c925eed | |||
14b54be15e | |||
7fb82f7447 | |||
4a5d44a0f1 | |||
1cba0284df | |||
6e4fe229bf | |||
7033075900 | |||
ded268ff3c | |||
a366f0b7eb | |||
507c8a1bfd | |||
1fb46bfa5d | |||
2e115968d5 | |||
83020797b0 | |||
0c4647e980 | |||
a20d2a04a8 | |||
57b0dccc7d | |||
d1e3bdf29a | |||
bdf7fedd7a | |||
c163662f4a |
38
.github/actions/always/action.yml
vendored
Normal file
38
.github/actions/always/action.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
---
|
||||
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
|
||||
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 }}
|
57
.github/actions/finalize/action.yml
vendored
Normal file
57
.github/actions/finalize/action.yml
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
---
|
||||
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
|
||||
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
|
||||
run: |
|
||||
set -ea
|
||||
|
||||
# https://stackoverflow.com/a/22464942/1559300
|
||||
trap '' PIPE
|
||||
|
||||
[[ '${{ 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 }}
|
153
.github/actions/publish/action.yml
vendored
Normal file
153
.github/actions/publish/action.yml
vendored
Normal file
@ -0,0 +1,153 @@
|
||||
---
|
||||
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
|
||||
id: 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
|
||||
|
||||
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
|
||||
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 }}
|
||||
|
||||
# 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
|
||||
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
|
70
.github/actions/test/action.yml
vendored
Normal file
70
.github/actions/test/action.yml
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
---
|
||||
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:
|
||||
- name: Delete previous draft release
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
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
|
||||
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
16
.github/workflows/flowzone.yml
vendored
Normal 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-latest","macos-latest","windows-2019"]'
|
20
.resinci.yml
20
.resinci.yml
@ -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"
|
@ -1,3 +1,182 @@
|
||||
- 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 +1022,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 +1052,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 +1135,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 +1178,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 +1252,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 +1282,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 +1421,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 +1509,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 +1879,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 +2969,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 +4642,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 +5154,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 +5452,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 +6822,7 @@
|
||||
- subject: "docker: Improve handling of Docker-in-Docker errors"
|
||||
hash: 9036ce9af373eb8d328f105839163db0cae38ae6
|
||||
body: >
|
||||
The `local` logging driver captures output from container’s
|
||||
stdout/stderr
|
||||
The `local` logging driver captures output from container’s stdout/stderr
|
||||
|
||||
and writes them to an internal storage that is optimized for performance and disk use.
|
||||
|
||||
@ -10310,8 +10481,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 +18107,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 +19650,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 it’s 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 it’s 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 they’re not logged in already without exiting the wizard.
|
||||
|
||||
@ -20151,9 +20320,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:
|
||||
|
||||
|
43
CHANGELOG.md
43
CHANGELOG.md
@ -4,6 +4,49 @@ 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.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]
|
||||
|
@ -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,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
@ -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}`,
|
||||
);
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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) {
|
||||
|
22
npm-shrinkwrap.json
generated
22
npm-shrinkwrap.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "balena-cli",
|
||||
"version": "14.4.1",
|
||||
"version": "14.5.6",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -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"
|
||||
|
13
package.json
13
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "balena-cli",
|
||||
"version": "14.4.1",
|
||||
"version": "14.5.6",
|
||||
"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"
|
||||
@ -285,6 +284,6 @@
|
||||
"windosu": "^0.3.0"
|
||||
},
|
||||
"versionist": {
|
||||
"publishedAt": "2022-10-12T13:55:51.707Z"
|
||||
"publishedAt": "2022-11-10T21:07:33.621Z"
|
||||
}
|
||||
}
|
||||
|
@ -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
Reference in New Issue
Block a user