Configure Jenkins to poll an environment by a script.
You can provide a script content or give a script file path.
Script execution exit code is checked.
If the script execution returns the expected code, a build is triggered.
You can configure the exit code. By default, the exit code is evaluated to '0'.