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
}
Gradle provides integration with several development tools and servers, including Eclipse, IntelliJ, Jenkins, and Android Studio.
Goto to the /job/<project>/configure screen. In "Build Environment" section check "Inject environment variables to the build process"
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.
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