How can I save a build configuration parameter's value to a file?

subj

0
7 comments

Hi Andrei,

Do you want to save build configuration parameter to the file while the build running? If yes, you can create a command line build step that prints build configuraion parameter's value to the file, for example:
echo %parameter_name% > file.txt

0

Thanks, this will work.

0

Unfortunately this doesn't work with values containing line feeds. Is there any other way?

0

Please quote the parameter the same way as you'd do using command line:
echo '% parameter_name%' > file.txt

0

Unfortunately this doesn't work on Windows build agents.

0
Avatar
Permanently deleted user

Hi Andrei,

Did you ever achieve this for multiline teamcity parameters from a command line build step on a Windows agent?

0

Unfortunately, simple echoing does not work in a Linux-based container either. At least in my case, when I have to have a well-formatted YAML file at the end. But the simple workaround with base64 encoding/decoding works pretty well. 

Encode yaml:

# Mac example
cat file.yaml | base64 | pbcopy

Insert the result to the configVar in TeamCity, hide it and declare it as a password.

Inside a docker container:

# Alpine-based helm container
echo %configVar% | base64 -d > /tmp/config.yaml
KUBECONFIG=/tmp/config.yaml
helm ls
0

Please sign in to leave a comment.