Using environment variables in command steps

1 minute read
End-of-life announcement

CodeShip will officially reach end-of-life on January 31, 2026.

To continue CI/CD services at current CodeShip pricing levels, transition to CloudBees Unify.

Next steps:

When defining command steps in codeship-steps.yml, it is common to want to 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