Configure Jenkins to poll an environment by a script.
You can provide a Groovy script content or give a Groovy script path.
If the Groovy script is evaluated to true, a build is triggered.