问题
I have a Jenkins build system up and running for a project. The build is triggered via the remote API functionality of Jenkins. When a commit is made to the project we send an HTTP request build trigger to the Jenkins process running on our local server; with a parameter that specifies the revision of the trunk project folder in the SVN repository that we want to checkout and build.
We also send the SVN username and commit message for the revision as an additional http parameter. So the URL looks like:
http://server:8080/job/ProjectName/buildWithParameters?description=[commit message]&REVISION=[revision number]
I would like to display this description parameter somewhere on the build page but I've found no obvious method of doing this via build triggering from the remote API.
Do I need to name the parameter something specific or is a plugin required for this functionality?
回答1:
One way to add a description is to add a Build Description. Jenkins displays a short text description under each build in the list of builds on the left of a project page.
You could use the Description Setter plugin to set the build description from within your build.
Or you can set the Build Description with a POST to http://server:8080/job/ProjectName/latestBuild/submitDescription
with the POST data: description="YOUR_DESCRIPTION_HERE"
. The latestBuild token can be replaced with a specific build number if you have it.
回答2:
There is this plugin to show build parameters
https://wiki.jenkins-ci.org/display/JENKINS/Show+Build+Parameters+Plugin
来源:https://stackoverflow.com/questions/19235943/adding-text-to-the-page-of-a-build-triggered-by-the-jenkins-remote-api