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

Hi,

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

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

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.

0

Please sign in to leave a comment.