Anthias icon indicating copy to clipboard operation
Anthias copied to clipboard

Can't build on balena

Open mmclane opened this issue 2 years ago • 9 comments

When filing a bug, please include the following headings if possible. Any example text in this template can be deleted.

Overview of the Issue

Can't build for balena any more..

When running ./bin/deploy_to_balena.sh with the latest balena cli you get an error:

4:13PM: ~/repos/public/screenly-ose [master|✔] k8s:[main] > ./bin/deploy_to_balena.sh Here are your Balena apps: Note: the command "balena apps" was replaced in CLI version v13.0.0. Please use "balena fleets" instead.

I upgraded to the latest version because I was getting other errors.

If I modify line 23 of ./bin/deploy_to_balena.sh and change it to balena fleets, I get further but still an error:

Here are your Balena apps:
ID      NAME         SLUG                    DEVICE TYPE  ONLINE DEVICES DEVICE COUNT
1946063 screenly     docnetwork/screenly     raspberry-pi 1              1
1880537 screenly-ose docnetwork/screenly-ose raspberrypi3 1              1

Enter the app name of the app you want to deploy to (needs to be SLUG): docnetwork/screenly
app is not a recognized balena command.

Did you mean: ? 
  api-key generate
  key

Run balena help -v for a list of available commands,
 or balena help <command> for detailed help on a specific command.

Reproduction Steps

Download balena cli v13.6.1 (latest) run ./bin/deploy_to_balena.sh

Environment

  • Raspberry Pi Hardware Version:
  • Raspberry Pi Network Setup: (ex. built-in WiFi, Ethernet, USB WiFi Adapter)
  • Screenly OSE Version:

mmclane avatar Jun 30 '22 20:06 mmclane

I went further and updated the script to the following

#!/bin/bash

# vim: tabstop=4 shiftwidth=4 softtabstop=4
# -*- sh-basic-offset: 4 -*-

set -euo pipefail

GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
GIT_SHORT_HASH=$(git rev-parse --short HEAD)
GIT_HASH=$(git rev-parse HEAD)


# Make sure balena cli is installed
if ! which balena > /dev/null; then
    echo 'Balena CLI not found. Please install and run again.'
    echo 'Installation instructions can be found here:'
    echo 'https://github.com/balena-io/balena-cli/blob/master/INSTALL.md'
    exit 1
fi


echo 'Here are your Balena apps:'
balena fleets
echo

read -p "Enter the app name of the app you want to deploy to (needs to be SLUG): " -r APP_NAME

# Get the device type from the device type in Balena
DEVICE_TYPE=$(balena fleet "$APP_NAME" | grep "DEVICE TYPE:" | sed 's/DEVICE TYPE: raspberry\(pi[0-9]\).*/\1/')

mkdir -p .balena
cat <<EOF > .balena/balena.yml
build-variables:
  global:
    - GIT_HASH=$GIT_HASH
    - GIT_SHORT_HASH=$GIT_SHORT_HASH
    - GIT_BRANCH=$GIT_BRANCH
  services:
      srly-ose-viewer:
        - DEVICE_TYPE=$DEVICE_TYPE
EOF

echo "Setting variables..."
balena env add BALENA_HOST_CONFIG_gpu_mem 128 --fleet "$APP_NAME"
balena env add BALENA_HOST_CONFIG_framebuffer_depth 32 --fleet "$APP_NAME"
balena env add BALENA_HOST_CONFIG_framebuffer_ignore_alpha 1 --fleet "$APP_NAME"

if [ "$DEVICE_TYPE" = "pi4" ]; then
    balena env add BALENA_HOST_CONFIG_dtparam "\"i2c_arm=on\",\"spi=on\",\"audio=on\",\"vc4-kms-v3d\"" --fleet "$APP_NAME"
fi

balena deploy --build "$APP_NAME"

But I am back to my original error: 4:20PM: ~/repos/public/screenly-ose [master|✚1] k8s:[main] !! ./bin/deploy_to_balena.sh Here are your Balena apps: ID NAME SLUG DEVICE TYPE ONLINE DEVICES DEVICE COUNT 1946063 screenly docnetwork/screenly raspberry-pi 1 1 1880537 screenly-ose docnetwork/screenly-ose raspberrypi3 1 1

Enter the app name of the app you want to deploy to (needs to be SLUG): screenly Setting variables... [Build] Building services... [Build] srly-ose-server Preparing... [Build] srly-ose-viewer Preparing... [Build] srly-ose-websocket Preparing... [Build] srly-ose-celery Preparing... [Build] redis Preparing... [Build] srly-ose-nginx Preparing... [Info] Building for rpi/raspberry-pi [Build] Built 6 services in 0 seconds [Error] Deploy failed Expecting VarList at build-variables.services.srly-ose-viewer but instead got: "Invalid variable list"

Additional information may be available with the --debug flag.

For further help or support, visit: https://www.balena.io/docs/reference/balena-cli/#support-faq-and-troubleshooting


mmclane avatar Jun 30 '22 20:06 mmclane

While I was able to build it.. its not running correctly.

mmclane avatar Jul 05 '22 13:07 mmclane

@mmclane what device and display are you using? We would like to replicate!

cc @nucleardreamer

mpous avatar Jul 13 '22 11:07 mpous

This is on a raspberry pi zero W.

I have also tried to install screenly on the device without balena and have failed to get that to work too.

mmclane avatar Jul 13 '22 12:07 mmclane

Oh, am I am using a monitor plugged in via HDMI currently.

mmclane avatar Jul 13 '22 12:07 mmclane

This should have been resolved in #1599

vpetersson avatar Sep 13 '22 10:09 vpetersson

It's unclear why, but the build phase of balena still doesn't work properly.

vpetersson avatar Sep 13 '22 13:09 vpetersson

I am definitely still getting the same error.

mmclane avatar Sep 19 '22 17:09 mmclane

We are working on revamping how we support Balena. Stay tuned for updates, but in the meantime, we are now automatically deploying to Balena as part of CI. You should be able to just mimic what we're doing there in the meantime.

vpetersson avatar Sep 21 '22 15:09 vpetersson