Search code examples
linuxcontinuous-integrationenvironment-variablesgo-cd

Linux command in Go server for continuous integration


I am using Go server for continuous integration of our code. For my environment-deploy-template, I wish to set certain environment variables on the stage and then echo those in the property files for the application. What would be the Linux command that I could give in my job to do so?

For example, it could be some thing like :

echo "propName=#{env variable}\n">>prop files location

Could someone please confirm this?


Solution

  • The syntax to get go.cd env variable is ${ENV_VAR} and a full command is:

    echo propName=${ENV_VAR} >> props.txt
    

    More details on environment variables: Using Environment Variables in Go