I have a parameterized job that uses the Perforce plugin and would like to retrieve the build parameters/properties as well as the p4.change property that’s set by the Perforce plugin.
How do I retrieve these properties with the Jenkins Groovy API?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Regarding parameters:
See this answer first. To get a list of all the builds for a project (obtained as per that answer):
When you find your particular build, you need to get all actions of type ParametersAction with
build.getActions(hudson.model.ParametersAction). You then query the returned object for your specific parameters.Regarding p4.change: I suspect that it is also stored as an action. In Jenkins Groovy console get all actions for a build that contains p4.change and examine them – it will give you an idea what to look for in your code.