Skip to content

Commit

Permalink
feat: add manual draft balena deploy action
Browse files Browse the repository at this point in the history
to allow us to manually trigger draft builds

Relates-to: #293
  • Loading branch information
shawaj committed Dec 3, 2021
1 parent a44d7aa commit 5b27542
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/push-to-prod-draft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: BalenaCloud Deploy (Production - Draft Deploy)

on:
workflow_dispatch:

jobs:
build-prod:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sbc: [raspi, rockpi]
frequency: [470, 868, 915]
variant: [indoor, outdoor]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: production
- 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
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"

open-fleet:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: production
- name: Balena Deploy
uses: nebraltd/balena-cli-action@v12.54.5
if: success()
with:
balena_api_token: ${{secrets.BALENA_API_TOKEN}}
balena_command: "deploy nebraltd/helium-miner --logs --debug --nocache --build --draft"

commercial:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: production
- name: Balena Deploy
uses: nebraltd/balena-cli-action@v12.54.5
if: success()
with:
balena_api_token: ${{secrets.BALENA_API_TOKEN}}
balena_command: "deploy nebraltd/helium-miner-commercial --logs --debug --nocache --build --draft"
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ the [production branch](https://github.com/NebraLtd/helium-miner-software/tree/p

Do note that the Docker Tag is hard coded in the `docker-compose.yml` file.

## Dealing with failed builds

On occasion (as originally described [in this issue](https://github.com/NebraLtd/helium-miner-software/issues/293)) CI/CD builds via GitHub actions will fail to push correctly to balena. We have found that as a workaround, it is often possible to force push these to balena as draft releases using the `--draft` tag in the `balena deploy` command of the balena CLI tool. For example:

```
balena deploy nebraltd/helium-indoor-868 --logs --debug --nocache --build --draft
```

This can either be done manually by someone with the right privileges on our balenaCloud account, or it can be done by triggering the `workflow_dispatch:` event on the [push-to-prod-draft.yml github action](https://github.com/NebraLtd/helium-miner-software/blob/master/.github/workflows/push-to-prod-draft.yml) from the GitHub actions menu (making sure to use the production branch).

Once this has completed and the draft builds have been pushed to balena, you will need to either finalise the releases using balena CLI locally, or visit the releases menu of each fleet with a draft release, click on the release and then select `Finalize Release` from the dropdown menu.

# Production Checks

@TODO:
Expand Down

0 comments on commit 5b27542

Please sign in to comment.