I'm confused, isn't it the one I provided? 
https://github.com/jenkinsci/blackduck-detect-plugin/blob/master/src/main/java/com/blackducksoftware/integration/detect/jenkins/post/DetectPostBuildStepDescriptor.java
 
?

it has setters for hubUrl, credentials, timeout... exactly what you have in 
global config:

<https://lh3.googleusercontent.com/-DTx-6L-z7H8/WsXHxStryDI/AAAAAAAAD3g/Xra8OSSHPzALmoaqbm0fFiNgDP33sxUTgCLcBGAs/s1600/Screen%2BShot%2B2018-04-05%2Bat%2B08.52.21.png>


so it would be - I'm guessing, haven't tried:


import com.blackducksoftware.integration.detect.jenkins.post.
DetectPostBuildStepDescriptor;

def blackduckDetectDesc = Jenkins.getInstance().getDescriptor("
com.blackducksoftware.integration.detect.jenkins.post.
DetectPostBuildStepDescriptor")

blackduckDetectDesc.setHubTimeout(60);

blackduckDetectDesc.setTrustSSLCertificates(true)


etc?


On Thursday, March 29, 2018 at 4:24:58 PM UTC+2, Sabyasachi Das wrote:
>
> Thanks Ewelina,
>
> Actually we are looking for a method to retrieve the class instance which 
> is keeping the BlackDuckHub configuration on master level.
>
>  
>
> For example for SonarQube it will be
>
>  
>
> import jenkins.model.Jenkins;
>
> import hudson.plugins.sonar.SonarGlobalConfiguration;
>
> import hudson.plugins.sonar.SonarInstallation;
>
>  
>
> def sonarDescr = 
> jenkins.getInstance().getDescriptorByType(SonarGlobalConfiguration)l
>
> sonarDescr.setInstallations(
>
> new SonarInstallation(
>
> 'sonar',
>
> 'http://sonarqube.com',
>
> // Other constructor properties...
>
> )
>
> );
>
> sonarDescr.save();
>
>
> Didn't find it in this class.
>
> On Monday, March 26, 2018 at 10:54:17 PM UTC+5:30, Ewelina Wilkosz wrote:
>>
>> I haven't tried that and don't know the plugin, but I think you need to 
>> find descriptor first
>> since I've found global.jelly for DetectPostBuildStep (
>> https://github.com/jenkinsci/blackduck-detect-plugin/blob/master/src/main/resources/com/blackducksoftware/integration/detect/jenkins/post/DetectPostBuildStep/global.jelly)
>>  
>> I would risk and say it may be that one: 
>>
>> https://github.com/blackducksoftware/blackduck-detect-plugin/blob/9993e4a22bf375c11d1872e4d619b83940b7e777/src/main/java/com/blackducksoftware/integration/detect/jenkins/post/DetectPostBuildStepDescriptor.java
>>
>> you can see there are public setters in it, so getDescriptor for 
>> com.blackducksoftware.integration.detect.jenkins.post 
>> (I guess) and use it to call setters
>> does it make sense to you?
>>
>> In the future, hopefully, Jenkins Configuration as Code Plugin will be 
>> able to take care of that for you :)
>>
>> On Monday, March 26, 2018 at 5:50:54 PM UTC+2, Sabyasachi Das wrote:
>>>
>>> Hi All,
>>>
>>> I have installed Blackduck detect plugin in jenkins. I want to do 
>>> Blackduck  detect configurations via groovy script.
>>>
>>> I am able to do using GUI Manage Jenkins -> configure system but need to 
>>> do similar activity via groovy script.
>>> Similar configurations for other plugins can be done for example below. 
>>> But for BlackDuck detect I cant find any appropriate class to provide.
>>> https://github.com/blackducksoftware/blackduck-detect-plugin
>>>
>>> Anyone please help me on this.
>>>
>>> Thanks,
>>> Sabya
>>>
>>> Sonar Script
>>> ==========================
>>> import jenkins.model.*
>>> import hudson.plugins.sonar.*
>>> import hudson.plugins.sonar.model.*
>>> import jenkins.plugins.slack.SlackNotifier
>>> import jenkins.plugins.git.GitSCMSource
>>>
>>> def inst = Jenkins.getInstance()
>>>
>>> def desc = inst.getDescriptor("hudson.plugins.sonar.SonarPublisher")
>>> //or slack or git
>>> def slack = instance.getDescriptor(SlackNotifier)
>>> def gitPluginSetup = instance.getDescriptor(GitSCM)
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/e496431c-067c-4490-8886-0f9269248a3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to