In codeship - I am trying to use the env variables. My setup looks like this:
codeship-services.yml
environment:
- ENV=my-var
codeship-steps.yml
type: parallel
steps:
- command: echo $ENV
I does not work, it just prints $ENV.
Environment variables are only available when you the command is invoked in the context of a shell. By default that's not the case (similar to how docker run
operates as well).
To get access to environment variables, either extract the command to a shell script and call the script instead, or explicitly invoke a shell
- service: app
command: sh -c "echo $ENV"