AdamXiaotCao
AdamXiaotCao

Reputation: 223

determine if it is jenkins environment inside gradle

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
}

Upvotes: 10

Views: 1426

Answers (1)

Slav
Slav

Reputation: 27485

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.

Upvotes: 4

Related Questions