Skip to content

Commit

Permalink
Update OpenFleet core files (production)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jun 27, 2023
1 parent 30490e7 commit f7c6b40
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 22 deletions.
61 changes: 51 additions & 10 deletions .github/workflows/build-open-fleet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ on:
workflow_dispatch:

env:
balena-cli: v16.1.0
balena-cli: v16.6.0
raspberrypi3-64: 2.114.18
raspberrypi4-64: 2.115.1
raspberrypicm4-ioboard: 2.112.12
rockpi-4b-rk3399: 2.108.25+rev1
balena-bobcat-image: 2023.06.25
bobcat-px30: 2.115.3
cloud: nebra-cloud

jobs:
Expand Down Expand Up @@ -62,7 +64,7 @@ jobs:
miner="$(echo ${{ github.event.repository.name }} | cut -d '-' -f2-)"
echo "Repo: $miner"
if [[ "$miner" =~ "nebra" ]] ; then
if [[ "$miner" =~ "nebra" ]] || [[ "$miner" =~ "bobcat" ]] ; then
variant="$miner"
elif [[ "$miner" == "og" ]] ; then
variant="helium-fl1"
Expand Down Expand Up @@ -131,6 +133,16 @@ jobs:
sudo ln -s /opt/balena-cli/balena /usr/bin/
cd ~
- name: Download base Balena OS image
uses: dsaltares/fetch-gh-release-asset@master
if: github.event.repository.name == 'helium-bobcat-px30' && env.BRANCH == 'master'
with:
repo: 'NebraLtd/balena-bobcat-px30'
version: 'tags/${{ env.balena-bobcat-image }}'
file: 'balena-image-bobcat-px30-${{ env.balena-bobcat-image }}.img.zip'
target: 'images/balena-base-${{ github.event.repository.name }}.img.zip'
token: ${{ secrets.MR_BUMP }}

- name: Generate a Balena OS image for the given board, variant, frequency
if: env.BRANCH == 'master'
run: |
Expand Down Expand Up @@ -174,6 +186,9 @@ jobs:
elif [ ${{ github.event.repository.name }} == 'helium-syncrobit' ] || [ ${{ github.event.repository.name }} == 'helium-linxdot' ] || [ ${{ github.event.repository.name }} == 'helium-pycom' ] || [ ${{ github.event.repository.name }} == 'helium-midas' ] ; then
balena_os="raspberrypicm4-ioboard"
balena_os_version="${{ env.raspberrypicm4-ioboard }}"
elif [ ${{ github.event.repository.name }} == 'helium-bobcat-px30' ] ; then
balena_os="isg-503"
balena_os_version="${{ env.bobcat-px30 }}"
elif [ ${{ env.ROCKPI }} == 'YES' ] ; then
balena_os="rockpi-4b-rk3399"
balena_os_version="${{ env.rockpi-4b-rk3399 }}"
Expand All @@ -189,10 +204,15 @@ jobs:
fi
if $NODRYRUN ; then
# Download the base image
balena os download "$balena_os" \
-o "$base_image_path" \
--version "$balena_os_version"
if [ ${{ github.event.repository.name }} != 'helium-bobcat-px30' ] ; then
# Download the base image
balena os download "$balena_os" \
-o "$base_image_path" \
--version "$balena_os_version"
else
unzip $IMAGE_BASE_PATH/*.zip -d $IMAGE_BASE_PATH/
mv ${IMAGE_BASE_PATH}/*.img ${base_image_path}
fi
fi
echo "IMAGE_BASE_PATH=$IMAGE_BASE_PATH" >> $GITHUB_ENV
Expand Down Expand Up @@ -246,10 +266,14 @@ jobs:
fi
if $NODRYRUN ; then
balena os configure "$image_path" \
--fleet "nebraltd/$fleet_name" \
--config-network ethernet \
--version "${{ env.balena_os_version }}"
if [ ${{ github.event.repository.name }} != 'helium-bobcat-px30' ] ; then
balena os configure "$image_path" \
--fleet "nebraltd/$fleet_name" \
--config-network ethernet \
--version "${{ env.balena_os_version }}"
else
sudo balena config inject ${GITHUB_WORKSPACE}/config.json --drive "${image_path}"
fi
fi
if $VERBOSE ; then
Expand All @@ -276,6 +300,23 @@ jobs:
sudo balena config inject $final_json_filename --drive "$image_path"
fi
if [ ${{ github.event.repository.name }} == 'helium-bobcat-px30' ] ; then
# Overwrite device type from "bobcat-px30" to "isg-503"
if $VERBOSE ; then
echo "Overwriting device-type"
fi
if $NODRYRUN ; then
sudo losetup -P -f "${image_path}"
loop_dev=$(losetup -l | grep $(basename "${image_path}") | cut -d ' ' -f 1)
tmpdir=$(mktemp -d)
sudo mount ${loop_dev}p1 ${tmpdir}
sudo sed -i 's/"slug": "bobcat-px30"/"slug": "isg-503"/' ${tmpdir}/device-type.json
sudo umount ${tmpdir}
sudo losetup -d ${loop_dev}
fi
fi
# Copy configuration files into boot and root partition of the balena image
if $VERBOSE ; then
Expand Down
28 changes: 16 additions & 12 deletions .github/workflows/update-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ jobs:
miner="$(echo ${{ github.event.repository.name }} | cut -d '-' -f2-)"
echo "Repo: $miner"
wget https://github.com/raw/NebraLtd/helium-miner-software/production/balena/balena.yml."$miner" -O balena.yml
wget https://github.com/raw/NebraLtd/helium-miner-software/production/balena/workflows/balena-app.yml -O .github/workflows/balena-app.yml
if [ $miner != 'bobcat-px30' ] ; then
wget https://github.com/raw/NebraLtd/helium-miner-software/production/balena/balena.yml."$miner" -O balena.yml
wget https://github.com/raw/NebraLtd/helium-miner-software/production/balena/workflows/balena-app.yml -O .github/workflows/balena-app.yml
wget https://github.com/raw/NebraLtd/helium-miner-software/production/balena/workflows/update-action-prod.yml -O workflows/update-action-prod.yml
wget https://github.com/raw/NebraLtd/helium-miner-software/production/balena/workflows/update-action-test.yml -O workflows/update-action-test.yml
fi
wget https://github.com/raw/NebraLtd/helium-miner-software/production/balena/workflows/update-files.yml -O .github/workflows/update-files.yml
wget https://github.com/raw/NebraLtd/helium-miner-software/production/balena/workflows/build-open-fleet.yml -O .github/workflows/build-open-fleet.yml
wget https://github.com/raw/NebraLtd/helium-miner-software/production/balena/workflows/update-action-prod.yml -O workflows/update-action-prod.yml
wget https://github.com/raw/NebraLtd/helium-miner-software/production/balena/workflows/update-action-test.yml -O workflows/update-action-test.yml
wget https://github.com/raw/NebraLtd/helium-miner-software/production/balena/ssh/ssh_public_keys.json -O ssh_public_keys.json
if [ $miner == 'pisces' ] ; then
Expand All @@ -44,7 +46,7 @@ jobs:
wget https://github.com/raw/NebraLtd/helium-miner-software/production/balena/config/config.txt.sensecap -O config.txt
elif [ $miner == 'risinghf' ] ; then
wget https://github.com/raw/NebraLtd/helium-miner-software/production/balena/config/config.txt.risinghf -O config.txt
elif [ $miner == 'nebra-indoor2' ] || [ $miner == 'nebra-outdoor2' ] || [ $miner == 'linxdot-rkcm3' ] || [ $miner == 'syncrobit-rkcm3' ] ; then
elif [ $miner == 'nebra-indoor2' ] || [ $miner == 'nebra-outdoor2' ] || [ $miner == 'linxdot-rkcm3' ] || [ $miner == 'syncrobit-rkcm3' ] || [ $miner == 'bobcat-px30' ] ; then
echo "No config.txt file needed - not RasPi based."
else
wget https://github.com/raw/NebraLtd/helium-miner-software/production/balena/config/config.txt.rak -O config.txt
Expand All @@ -55,7 +57,7 @@ jobs:
with:
branch: master
file-path: |
balena.yml
balena.ym*
config.*
.github/workflows/*.yml
ssh_public_keys.json
Expand All @@ -81,12 +83,14 @@ jobs:
miner="$(echo ${{ github.event.repository.name }} | cut -d '-' -f2-)"
echo "Repo: $miner"
wget https://github.com/raw/NebraLtd/helium-miner-software/master/balena/balena.yml."$miner" -O balena.yml
wget https://github.com/raw/NebraLtd/helium-miner-software/master/balena/workflows/balena-app.yml -O .github/workflows/balena-app.yml
if [ $miner != 'bobcat-px30' ] ; then
wget https://github.com/raw/NebraLtd/helium-miner-software/master/balena/balena.yml."$miner" -O balena.yml
wget https://github.com/raw/NebraLtd/helium-miner-software/master/balena/workflows/balena-app.yml -O .github/workflows/balena-app.yml
wget https://github.com/raw/NebraLtd/helium-miner-software/master/balena/workflows/update-action-prod.yml -O workflows/update-action-prod.yml
wget https://github.com/raw/NebraLtd/helium-miner-software/master/balena/workflows/update-action-test.yml -O workflows/update-action-test.yml
fi
wget https://github.com/raw/NebraLtd/helium-miner-software/master/balena/workflows/update-files.yml -O .github/workflows/update-files.yml
wget https://github.com/raw/NebraLtd/helium-miner-software/master/balena/workflows/build-open-fleet.yml -O .github/workflows/build-open-fleet.yml
wget https://github.com/raw/NebraLtd/helium-miner-software/master/balena/workflows/update-action-prod.yml -O workflows/update-action-prod.yml
wget https://github.com/raw/NebraLtd/helium-miner-software/master/balena/workflows/update-action-test.yml -O workflows/update-action-test.yml
wget https://github.com/raw/NebraLtd/helium-miner-software/master/balena/ssh/ssh_public_keys.json -O ssh_public_keys.json
if [ $miner == 'pisces' ] ; then
Expand All @@ -101,7 +105,7 @@ jobs:
wget https://github.com/raw/NebraLtd/helium-miner-software/master/balena/config/config.txt.sensecap -O config.txt
elif [ $miner == 'risinghf' ] ; then
wget https://github.com/raw/NebraLtd/helium-miner-software/master/balena/config/config.txt.risinghf -O config.txt
elif [ $miner == 'nebra-indoor2' ] || [ $miner == 'nebra-outdoor2' ] || [ $miner == 'linxdot-rkcm3' ] || [ $miner == 'syncrobit-rkcm3' ] ; then
elif [ $miner == 'nebra-indoor2' ] || [ $miner == 'nebra-outdoor2' ] || [ $miner == 'linxdot-rkcm3' ] || [ $miner == 'syncrobit-rkcm3' ] || [ $miner == 'bobcat-px30' ] ; then
echo "No config.txt file needed - not RasPi based."
else
wget https://github.com/raw/NebraLtd/helium-miner-software/master/balena/config/config.txt.rak -O config.txt
Expand All @@ -112,7 +116,7 @@ jobs:
with:
branch: testnet
file-path: |
balena.yml
balena.ym*
config.*
.github/workflows/*.yml
ssh_public_keys.json
Expand Down

0 comments on commit f7c6b40

Please sign in to comment.