Retrieve config.xml for Jenkins job within a plugin in java code

121 views
Skip to first unread message

HALLEY SALAM

unread,
May 19, 2021, 8:54:46 AM5/19/21
to Jenkins Developers

Greetings Everyone,

I am new to Jenkins and just started contributing to developing a plugin for Jenkins where I need to extract some values from the job config.xml. I am able to retrieve the config.xml with the below approaches:

  1. Accessing through /config.xml
  2. By creating Jenkins client and invoking getJobXml() method passing the job name

But in both the cases I need to pass the Jenkins credentials which shall not be the case since I am trying to access from within the running Jenkins instance. And also above approaches can be implemented in any external project if one knows the credentials to access the Jenkins instance. I want an approach which shall be bound within the plugin meaning I shall be able to read the config.xml via the job name without providing any credentials.

Could anyone provide me the best solution to read the config.xml within the java code? Any assistance is highly appreciated. Thank you in advance.


Regards,

Halley

Reply all
Reply to author
Forward
0 new messages