Are there any widely accepted methods for an *.exe to detect if it's running as part of an ADO pipeline? The script will be running both as part of a pipeline and on workstations and should be able to determine with very high confidence where it is running, if possible.
Eg. any pre-defined variables that are meant for this (could not find) or some other pre-defined value that can be inspected?
There is a whole number of predefined variables, most of which you could use, I would say. However, there is one which sounds like what you are looking for:
TF_BUILD
Set to True if the script is being run by a build task.
This variable is agent-scoped, and can be used as an environment variable in a script and as a parameter in a build task, but not as part of the build number or as a version control tag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With