I would like to add an environment variable in the environment section You should always use a parser to do that kind of updating, using a shell script (calling sed or awk) that doesn't know about yaml internals is guaranteed to break at some point. I would like to do this from the command line
I have tried sed and echo This will only work if you only have version It does get added but without the correct indentation and yml format is very syntax sensitive.
Ideal for developers and system administrators, `yq` maintains original file formatting and provides a powerful alternative to manual editing. In the bash shell, we need tools to deal with yaml content from the command line or script In this tutorial, we’re going to learn about the yq utility The yq command is usually not a part of standard linux distribution, so we need to install it manually
Then, let’s go through the command’s basics If you'd like to overwrite the original file, i recommend writing to a temporary file first and only if that succeeds, use os.rename to move that file in place of the original one. The yaml document is read on standard input and the resulting document is written to standard output Pattern matches something from the source
Is the content of the text in parentheses in the pattern