Check Travis CI Testing Env in MIT lab [Enterprise Customer]

In the MIT lab, some of our engineers want to see if they are working on the Travis CI testing environment instead of prod, any idea on how to do this?

We would like to progmatatically determine if a particular Python script is running a testing environment.

I realize that this will require some heuristics, but that’s good enough for me. Are certain environment variables always set? Is the user name always the same?

Environment variables are generally set for each CI/CD pipeline tool, so for example:


This will return true in a Python script when executed in the respective tool environment:

os.getenv("TRAVIS") == "true"` in a Travis CI pipeline.

NB: If I’m not mistaken, to identify the Python script is being executed in Kubernetes Service host, the behavior isn’t the same.