Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
}
like image 502
AdamXiaotCao Avatar asked Jun 09 '15 16:06

AdamXiaotCao


People also ask

Does Jenkins support gradle?

Gradle provides integration with several development tools and servers, including Eclipse, IntelliJ, Jenkins, and Android Studio.

How can I see environment variables in Jenkins?

Goto to the /job/<project>/configure screen. In "Build Environment" section check "Inject environment variables to the build process"


1 Answers

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.

like image 52
Slav Avatar answered Oct 16 '22 07:10

Slav