How to read helm environment specific variables (replaced by octopus) in nodejs application

3/15/2019

I have nodejs application deployed in Octopus using helm. I want to read appVersion value in '.yaml file' that is replaced by octopus. How can I read that in nodejs application

-- Narsing Rao Allumalla
kubernetes-helm
octopus-deploy

1 Answer

3/15/2019

I had a similar problem but I solved it using a shell script and parsing the line I needed.

As the order of lines in YAML is irrelevant, I put the the appVersion line at last, then used the code below to get the version.

tail -n 1 helm/pfweb/Chart.yaml | awk '{print $2}'

You could run this code inside Node code using Child Process

Or you can read file from Node using readFileSync and parse which line you want. IMHO, this is more painful way to solve it, because I don't program in Node.

-- Mauro Baraldi
Source: StackOverflow