Skip to content

Commit

Permalink
Update trigger documentation to include using a CRUMB for security.
Browse files Browse the repository at this point in the history
  • Loading branch information
p4paul committed Oct 13, 2016
1 parent 0a66717 commit 82c542a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions SETUP.md
Expand Up @@ -168,6 +168,22 @@ and have an entry in `p4 triggers` for changes on `//depot/...`:

jenkins change-commit //depot/... "/p4/common/bin/triggers/jenkins.sh %change%"


Note: If your Jenkins server needs authentication you will also need to provide a security 'CRUMB'. The following is an example of how you can get this and use to trigger a job:

#!/bin/bash
CHANGE=$1
USER=triggeruser
PASSWORD=Password
P4PORT=localhost:1666
SERVER=http://localhost:8080

# Get CRUMB
CRUMB=$(curl -s --user $USER:$PASSWORD $SERVER/crumbIssuer/api/xml?xpath=concat\(//crumbRequestField,%22:%22,//crumb\))

# Trigger builds across all triggered jobs (where relevant)
curl -s --user $USER:$PASSWORD -H "$CRUMB" --request POST --data "payload={change:$CHANGE,p4port:\"$P4PORT\"}" $SERVER/p4/change

On the Jenkins side you need to enable the 'Perforce triggered build' in the Job Configuration:

![Perforce trigger](docs/images/p4trigger.png)
Expand Down

0 comments on commit 82c542a

Please sign in to comment.