Hi,
We would like to tag each release when it gets deployed,
we’re using
DEBUG=1 balena deploy ${APP} --projectName ${MACHINE} --tag ${APP_TAG} --build
to deploy a new release which then creates a release ID like:
[Success] Release: 123925a3f445ac29abbd81119f883abc
that I want to use to tag it with:
balena tag set version SomeRelease.RC.TEST --release 123925a3f445ac29abbd81119f883abc
and I would like toi do it all in a bash script but am wondering can I retrieve the generated release id?
If only need the to tag the latest release, balena app
should be enough:
balena tag set version SomeRelease.RC.TEST --release $(balena app "${APP}" | grep COMMIT | awk '{print $2}')
2 Likes
Hi Ereski,
This works fine but won’t work with a pinned release in an application. balena app
will always print the hash of the pinned release instead of the latest i.e. I will end up tagging the wrong release. How can I work around this? Thanks!
Hi
We have a SDK which you could use to do this. In that we have a function to get all the releases from an application - see the docs here
Once you have this integrated in your bash script, you should be able to get the latest release .
Does that work for you?
1 Like
Thanks, I instead use | tee
to write the output to a file and then extract the just created tag with grep
and awk
. Works like a charm! Thanks!