balena AUFS preload on GitHub Actions

I thought this might come in handy for other people who are trying to download balena OS disk images, configure and preload them on GitHub actions and are getting the error “AUFS not found” or similar (which applies for earlier raspberry pi models and some other devices which haven’t been transitioned to the overlay - see here for a list).

This action uses Ubuntu 18.04 base and allows you to install and configure AUFS as well as the balena CLI tool and then use it to configure and preload an image. I’ve removed some parts (strategy matrix part and some other application specific env variables so just the necessary stuff for AUFS is left).

Hope this might be helpful to someone in the future…

name: BalenaCloud Create Image (RasPi)

on:
  schedule:
    - cron:  "0 0 * * 0" # Run weekly
  workflow_dispatch:

env: 
  balena-cli: v12.55.4

jobs:
  raspi:
    runs-on: ubuntu-18.04
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Install latest balena-cli
        run: |
          sudo apt-get update
          sudo apt-get install -y curl unzip zip lxc libarchive-tools aufs-tools
          sudo modprobe aufs
          cd /opt/
          echo "Uses Balena CLI version: ${{ env.balena-cli }}"
          cat /etc/docker/daemon.json
          echo "$(grep aufs /proc/filesystems)"
          echo "$(docker info)" 
          curl -O -sSL "https://github.com/balena-io/balena-cli/releases/download/${{ env.balena-cli }}/balena-cli-${{ env.balena-cli }}-linux-x64-standalone.zip"
          unzip balena-cli-*-linux-x64-standalone.zip
          sudo ln -s /opt/balena-cli/balena /usr/bin/
          cd ~
          
      - name: Balena login
        run: balena login --token ${{ secrets.BALENA_API_TOKEN }} > /dev/null

      - name: Download OS image
        run: balena os download "${{ matrix.baseos }}" -o balena-base.img --version "${{ env.BALENA_OS_VERSION }}" --debug

      - name: Configure image
        run: balena os configure balena-base.img --fleet "nebraltd/${{ env.FLEET_NAME }}" --config-network ethernet --version "${{ env.BALENA_OS_VERSION }}" --debug

      - name: Preload image
        run: balena preload balena-base.img --fleet nebraltd/"${{ env.FLEET_NAME }}" --pin-device-to-release -c current --debug

3 Likes