How to check if my bash script is running inside a TeamCity agent?


I want to add a condition like this to a shell script:

if running inside TeamCity then
  echo "Inside TeamCity"
  echo "Not inside TeamCity"

There are a bunch of environment variables that I can use to do this -- but what is the proper way of doing it?

1 comment
Comment actions Permalink

You can check for presence of this environment variable: TEAMCITY_VERSION
It is always set for a running build.


Please sign in to leave a comment.