Sorry, I meant to type trigger script, not polling script. They are two different things entirely.
It depends on what you intend. That stack overflow question is specifically about running a build per change list, not necessarily about a post commit trigger as this ticket describes.
In the case of this ticket, you would need to write a post commit trigger in perforce that analyzes each change, and kicks off the associated builds using the Jenkins REST api or CLI. As I mentioned, the script will need to do the heavy lifting, since there's no "notifyCommit" interface yet, which is what this ticket is for.
Assigning to one of the Perforce plugin maintainers to ask a question.
Perforce already has a trigger mechanism, all that needs to be done is add support for that on Jenkins, similar to that in the Subversion and Git plugins: https://wiki.jenkins-ci.org/display/JENKINS/Subversion+Plugin
Something like this I imagine would be executed in the perforce trigger script:
/usr/bin/wget \
--header "Content-Type:text/plain;charset=UTF-8" \
--post-data "$CHANGELIST $P4_PATH`" \
-
output-document "" \--timeout=2 \
http://server/perforce/notifyCommit?rev=$REV
Is there any other way of doing this already?
(Polling the repository seems like a suboptimal solution. Can miss changelists, and has to be done quite frequently)