How to Trigger Jenkins from a Perforce Server running Windows

Ever since version 1.3.9 of the Jenkins P4 Plugin, it’s possible to trigger Jenkins jobs from a Perforce commit. There’s a Cloudbees article that discusses how the Jenkins plugin works in detail.

In the article, it discusses how to create a Perforce trigger so that when change-commit events occur, a script would submit a POST to the REST API to trigger Perforce jobs. The script, while simple, was written for bash and targets servers running Linux.

Below is the Windows equivalent script if you don’t want to figure out how to run bash on Windows. This script is adapted from the Swarm trigger script as it operates similarly and also requires curl.

Leave a Reply