determine if it is jenkins environment inside gradle

1.3k Views Asked by At

I am just wondering is it possible that I can tell whether I am in a Jenkins environment inside gradle? I just want to do something like

if (jenkins){
  //do something
}else{
  //do other
}
1

There are 1 best solutions below

1
On BEST ANSWER

You could check for existence of build-specific environment variables, like $BUILD_ID or $BUILD_URL, etc. They really shouldn't exist outside of Jenkins build, but if your environment is polluted, you could have them.