How do I access all Job Configuration properties in my Plugin code?

42 views
Skip to first unread message

Quadir Sha Kareemullah

unread,
Jun 30, 2014, 1:14:12 AM6/30/14
to jenkin...@googlegroups.com
Hi,

I would greatly appreciate if anyone can tell me how I can access all Job Configuration properties in my Plugin code. I tried following snippet, but pdp is returning null.

 
ParametersDefinitionProperty pdp = this.project.getProperty(ParametersDefinitionProperty.class);
 

Here is little background, I am trying to dynamically set the branch name that Git needs to build. In the Job Configuration, I enter ${pull_req_src_branch} for the field "Branches to build Branch Specifier (blank for 'any')". I want to set this value dynamically in my Plugin code when the Jobs runs.

Any help is greatly appreciated.

Thanks
Quadir
 

Sandell, Robert

unread,
Jun 30, 2014, 4:03:36 AM6/30/14
to jenkin...@googlegroups.com

You could try and implement a BuildChooser: https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/util/BuildChooser.java

 

 

 

Robert Sandell

Software Tools Engineer - SW Environment and Product Configuration

Sony Mobile Communications

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Quadir Sha Kareemullah

unread,
Jul 1, 2014, 2:00:18 AM7/1/14
to jenkin...@googlegroups.com
Hi Robert,

Thanks for your reply. I was NOT able to figure out how to use BuildChooser to get all configuration properties of a Job (not Build). I would greatly appreciate if you can provide a sample code snippet.

Thanks
Quadir

Sandell, Robert

unread,
Jul 1, 2014, 4:55:42 AM7/1/14
to jenkin...@googlegroups.com

My idea was more around not using parameters but instead configure the git plugin to use your buildchooser to provide what to build, my assumption was that the rest of your plugin code had the necessary information needed for the buildchooser to use.

You can see examples of BuildChooser implementations on the wiki: https://wiki.jenkins-ci.org/display/JENKINS/Extension+points#Extensionpoints-hudson.plugins.git.util.BuildChooser

And here is one from my plugin: https://github.com/jenkinsci/gerrit-trigger-plugin/blob/master/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTriggerBuildChooser.java

felipe...@gmail.com

unread,
Feb 18, 2019, 2:14:05 AM2/18/19
to Jenkins Developers
Have you ever found out the solution to this? I was looking to access the Git steps configuration directly. 
Reply all
Reply to author
Forward
0 new messages