Hello everyone!
Lets me present you alternative to the “balena push” based on Github Actions.
You are welcome to create pull requests.
Need your help to implement the whole process of build such as “balena deploy”, etc.
Also need understand the way of adding cert to docker-worker
Open for your proposals, and feature requests.
At action page you can see the example
My own idea was to use a self-hosted Github Actions runner which allow using custom CA and certs for deploying code to the cloud.
If you will find a workaround how to use custom ca.crt in Github Actions worker - it will be incredible!
For using functionality as balena push - just create git in project folder - upload your code to repo and using Actions tab - create your own job with using example!
I’ve managed to work out the variables and script. But I think I’m running into the ca.crt issue you mention. Is this what you’re seeing in the github logs?
Retrying "registry.***/v2/f14c323e365b7cdd434b3e928e134c30:latest" after 2.0s (1 of 2) due to: Error: Get [https://registry.***/v2/:](https://registry.%2A%2A%2A/v2/:) x509: certificate signed by unknown authority
Maybe @dfunckt you have any suggestions re getting the ca.crt deployed properly in a github action flow?
This helps if you have distributed team for development.
You can host runner in another place for creating releases in async mode)
For building you can use balena build - just in case for test if everything is ok, and use deploy for uploading it to prod.
I already had mentioned possibility to run worker in background as service in my guide https://docs.solar-control.tech/openbalena/open-balena-push-analog#installing-runner-as-a-service
Haha - this is ok. I was excited to create guide too.
Github Actions (GA) is very powerfull tools, you can use GithubApi to trigger builds, and so on.
Like a “one ring to rule them all”, GA give opportunity to recreate part of functionality provided by balenaCloud!
My next step will be something like OS configurer for apps, which upload your customized system image to specified S3 storage, or just publish it directly in repo as artifact
@teslov any thoughts on how we might use the action steps to update the application environment variables in openbalena?
I’m interested updating the app’s envs with info about the release/commit automatically, so that downstream we can see that the device is running the correct commit in the logs.
This is kinda what I was thinking:
Set up first env for the application manually in CLI: balena env add commit null --application testing
Retrieve the env ID with balena envs --application testing
ID NAME VALUE APPLICATION SERVICE
1 COMMIT null testing *
On each deployment (where GITHUB_SHA is the commit id) balena env rename 1 $GITHUB_SHA
Confirm the change with balena envs --application testing
ID NAME VALUE APPLICATION SERVICE
1 COMMIT 123abc456def testing *
You would know better than myself, but can we just add that as another command to the action yml?
I think you have a posibility to use && in balena command to combine it.
Like deploy && balena env rename 1 ${SHA VARIABLE HERE}
Or using pipe to use output in another command like devices | grep ....
Part of commands running in sh script, so you are not limited to expand it with your custom logic.
With using key --output json you can try jq tool, for processing it as json
The best way to implement your logic - just add new workflow to repo, with another purpose - dividing workflow by functions - is better.
If you are depends on success of your build - just add it as new job in workflow tree.
If you need so, i will provide possibility to use docker secrets in actions due to using custom docker registries and images.
And in next versions I will add Json as variable functionality with custom logic
Maybe at this, or next week