The plugin provides the following functionality:
Several variables can be passed by the message URL or body. There is a special variable containing
comma separated list of available variables:
${all_keys}
There is no dedicated field for authorization. One can add authorization header into 'headers'. In such case the field will look like:
Please visit wikipedia to learn how to construct basic auth header.
For Jenkins it is recommended to use Build Token Root Plugin. It allows using anonymous request + build token (think of API key).
ALL
BBBUILD
in Build Triggers
Trigger builds remotely (e.g., from scripts)
http://localhost:8080/buildByToken/buildWithParameters?token=BBBUILD&job=Bitbucket%20Capture&ALL=Hello
Entering URL will take you to an empty page. Back in Jenkins you should see that the job was triggered and parameter is successfully passed:
ACTION
PR_ID
REPO
PROJECT
Pull Request Hook
http://localhost:8080/buildByToken/buildWithParameters?token=BBBUILD&job=Bitbucket%20Capture&ALL=${all_keys}&ACTION=${action}&PR_ID=${pr_id}&REPO=${repo}&PROJECT=${project}
After that you should notice that a new builds were run. Inspect those builds parameters.
Jenkins job config.xml
:
<project> <actions/> <description/> <keepDependencies>false</keepDependencies> <properties> <hudson.model.ParametersDefinitionProperty> <parameterDefinitions> <hudson.model.StringParameterDefinition> <name>ALL</name> <description/> <defaultValue/> </hudson.model.StringParameterDefinition> </parameterDefinitions> </hudson.model.ParametersDefinitionProperty> </properties> <scm class="hudson.scm.NullSCM"/> <canRoam>true</canRoam> <disabled>false</disabled> <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding> <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding> <authToken>BBBUILD</authToken> <triggers/> <concurrentBuild>false</concurrentBuild> <builders/> <publishers/> <buildWrappers/> </project>
There is a button in the configuration dialog that leads to a log. Communications are logged per-repository.