Skip to content

Commit

Permalink
fix: add multiple API tokens for balena
Browse files Browse the repository at this point in the history
- add multiple balena API tokens to avoid (or at least reduce the impact of) rate limiting
- add random sleep to testnet pushes

Relates-to: #293
Relates-to: #299
Relates-to: #300
  • Loading branch information
shawaj committed Dec 7, 2021
1 parent 024cd80 commit baafe64
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 12 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/push-to-prod-draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,18 @@ jobs:
sed -i -E "s/\/dev\/i2c-1:\/dev\/i2c-1/\/dev\/i2c-7:\/dev\/i2c-7/g" docker-compose.yml
ROCKPI="-rockpi"
echo "ROCKPI=$ROCKPI" >> $GITHUB_ENV
- name: Balena Deploy
- name: Balena Deploy (ROCK Pi)
if: matrix.sbc == 'rockpi' && success()
uses: nebraltd/balena-cli-action@v12.54.5
if: success()
with:
balena_api_token: ${{secrets.BALENA_API_TOKEN}}
balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }}${{ env.ROCKPI }} --logs --debug --nocache --build --draft"
- name: Balena Deploy (RasPi)
if: matrix.sbc == 'raspi' && success()
uses: nebraltd/balena-cli-action@v12.54.5
with:
balena_api_token: ${{secrets.BALENA_API_TOKEN_1}}
balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }} --logs --debug --nocache --build --draft"

open-fleet:
runs-on: ubuntu-latest
Expand All @@ -45,7 +51,7 @@ jobs:
uses: nebraltd/balena-cli-action@v12.54.5
if: success()
with:
balena_api_token: ${{secrets.BALENA_API_TOKEN}}
balena_api_token: ${{secrets.BALENA_API_TOKEN_2}}
balena_command: "deploy nebraltd/helium-miner --logs --debug --nocache --build --draft"

commercial:
Expand All @@ -61,5 +67,5 @@ jobs:
uses: nebraltd/balena-cli-action@v12.54.5
if: success()
with:
balena_api_token: ${{secrets.BALENA_API_TOKEN}}
balena_api_token: ${{secrets.BALENA_API_TOKEN_3}}
balena_command: "deploy nebraltd/helium-miner-commercial --logs --debug --nocache --build --draft"
14 changes: 10 additions & 4 deletions .github/workflows/push-to-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,18 @@ jobs:
sed -i -E "s/\/dev\/i2c-1:\/dev\/i2c-1/\/dev\/i2c-7:\/dev\/i2c-7/g" docker-compose.yml
ROCKPI="-rockpi"
echo "ROCKPI=$ROCKPI" >> $GITHUB_ENV
- name: Balena Deploy
- name: Balena Deploy (ROCK Pi)
uses: nebraltd/balena-cli-action@v12.54.5
if: success()
if: matrix.sbc == 'rockpi' && success()
with:
balena_api_token: ${{secrets.BALENA_API_TOKEN}}
balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }}${{ env.ROCKPI }} --logs --debug --nocache --build"
- name: Balena Deploy (RasPi)
uses: nebraltd/balena-cli-action@v12.54.5
if: matrix.sbc == 'raspi' && success()
with:
balena_api_token: ${{secrets.BALENA_API_TOKEN_1}}
balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }} --logs --debug --nocache --build"

open-fleet:
runs-on: ubuntu-latest
Expand All @@ -44,7 +50,7 @@ jobs:
uses: nebraltd/balena-cli-action@v12.54.5
if: success()
with:
balena_api_token: ${{secrets.BALENA_API_TOKEN}}
balena_api_token: ${{secrets.BALENA_API_TOKEN_2}}
balena_command: "deploy nebraltd/helium-miner --logs --debug --nocache --build"

commercial:
Expand All @@ -58,5 +64,5 @@ jobs:
uses: nebraltd/balena-cli-action@v12.54.5
if: success()
with:
balena_api_token: ${{secrets.BALENA_API_TOKEN}}
balena_api_token: ${{secrets.BALENA_API_TOKEN_3}}
balena_command: "deploy nebraltd/helium-miner-commercial --logs --debug --nocache --build"
12 changes: 10 additions & 2 deletions .github/workflows/push-to-testnet-draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,23 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Random sleep (balena API workaround)
run: sleep $[ ( $RANDOM % 180 ) + 1 ]s
- name: Change i2c bus for RockPi
if: matrix.sbc == 'rockpi'
run: |
sed -i -E "s/\/dev\/i2c-1:\/dev\/i2c-1/\/dev\/i2c-7:\/dev\/i2c-7/g" docker-compose.yml
ROCKPI="-rockpi"
echo "ROCKPI=$ROCKPI" >> $GITHUB_ENV
- name: Balena Deploy
- name: Balena Deploy (ROCK Pi)
uses: nebraltd/balena-cli-action@v12.54.5
if: success()
if: matrix.sbc == 'rockpi' && success()
with:
balena_api_token: ${{secrets.BALENA_API_TOKEN}}
balena_command: "deploy nebraltd/helium-testnet${{ env.ROCKPI }} --logs --debug --nocache --build --draft"
- name: Balena Deploy (RasPi)
uses: nebraltd/balena-cli-action@v12.54.5
if: matrix.sbc == 'raspi' && success()
with:
balena_api_token: ${{secrets.BALENA_API_TOKEN_1}}
balena_command: "deploy nebraltd/helium-testnet --logs --debug --nocache --build --draft"
12 changes: 10 additions & 2 deletions .github/workflows/push-to-testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,23 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Random sleep (balena API workaround)
run: sleep $[ ( $RANDOM % 180 ) + 1 ]s
- name: Change i2c bus for RockPi
if: matrix.sbc == 'rockpi'
run: |
sed -i -E "s/\/dev\/i2c-1:\/dev\/i2c-1/\/dev\/i2c-7:\/dev\/i2c-7/g" docker-compose.yml
ROCKPI="-rockpi"
echo "ROCKPI=$ROCKPI" >> $GITHUB_ENV
- name: Balena Deploy
- name: Balena Deploy (ROCK Pi)
uses: nebraltd/balena-cli-action@v12.54.5
if: success()
if: matrix.sbc == 'rockpi' && success()
with:
balena_api_token: ${{secrets.BALENA_API_TOKEN}}
balena_command: "deploy nebraltd/helium-testnet${{ env.ROCKPI }} --logs --debug --nocache --build"
- name: Balena Deploy (RasPi)
uses: nebraltd/balena-cli-action@v12.54.5
if: matrix.sbc == 'raspi' && success()
with:
balena_api_token: ${{secrets.BALENA_API_TOKEN_1}}
balena_command: "deploy nebraltd/helium-testnet --logs --debug --nocache --build"

0 comments on commit baafe64

Please sign in to comment.