I would like to use the git commit and tag info as data in my flow. (to use in some logging or to show in a UI screen). This would be very helpfull if you have xx instances running on edge devices in the field.
I think you can get that info in your flow by using the git commands from an exec node.
Have a look at the output of
git -C /path/to/repo log --oneline HEAD^..HEAD
That will show you the latest commit hash, branch and message.
Normally you would execute git commands from within the working copy, so you need the
-C parameter to specify the path of your node-red workspace/project to get it working from an exec node
git describe command could be useful too, if you use tags.
Thanks for the suggestion. The hardest part in that scenario is getting the workspace/project path. Especially since I'm working with production/development environments. So still considering whether it's wise to fetch this git info inside the flow or as an alternative, to run external script during a deployment procedure, save it to a file and let my flow read this info on start-up.
You could use environment variables for specifying the path. You wouldn't have to touch each flow individually then.
Another thought... the runtime needs to know that path anyway. Maybe it's available somehow through some API or some env-var already.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.