I have a program that cannot read from an environment variable, and is hard-coded to look for a config file (kubernetes .config file). I have a working config file, and use it already populating an env variable which works for apps that can read that variable (i.e. helm). I still want the benefits of using the credentials plugin, but need to have that env variable populate a local file.
I've tried just doing an:
echo KUBECONFIG > ./.kube/config # path the app expects to find the file
but it doesn't seem to actually put the actual secret file. I echoed it to od -a as mentioned in a comment here https://support.cloudbees.com/hc/en-us/articles/203802500-Injecting-Secrets-into-Jenkins-Build-Jobs and it has a path to the like /var/lib/jenkins/...<job path>/workspace/..<more stuff>/<secret name> but not the actual secret content.
Is there a way to get this var to write to a file? I plan to have it delete afterwards, and never write to the console, so would really like to be able to figure out how to do this. So far I've tried about 40 different ways (even having a helper script that pulls the env and writes it to a file, but no luck yet. Any pointers here would be helpful.