This article is about Codeship Pro.

Using Environment Variables in Command Steps

You will need about one minute to read this article.

In order to interpolate environment variables into codeship-steps.yml command steps, the entire step must be wrapped in a shell command.

For example, the command without a shell wrapper…

- service: app
  command: echo The branch name is: $CI_BRANCH

…results in:

The branch name is: $CI_BRANCH


Whereas a command with a shell wrapper…

- service: app
  command: /bin/sh -c 'echo The branch name is: $CI_BRANCH'

…results in:

The branch name is: master

Need more help?

Contact our support team or post on Stack Overflow using the tag #codeship. Did you check the status page and changelog?

There are also several code examples and sample projects available for you to get started with.

Article not helpful?

Does this article need improvement? If so, please send feedback or submit a pull request!