Re: JDK Installer Groovy script

2017-01-12 Thread Victor Martinez
I've just found those variables are private:

- 
https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/tools/JDKInstaller.java#L739-L741

So no way to set them directly unless running the method doPostCredential

import jenkins.model.*

import hudson.model.*

  

def inst = Jenkins.getInstance()

def desc = inst.getDescriptor("hudson.tools.JDKInstaller")

println desc.doPostCredential('YourEmailAccount','YourPassword')



I hope it helps

Cheers

On Thursday, 30 June 2016 14:23:45 UTC+1, Stijn Diependaele wrote:
>
> Hey Mike,
>
> We decided not to download from Oracle. Instead we have a local repo and 
> we use puppet to manage/install the java package. So I did it like in the 
> script above by setting the name and the path where java is installed.
>
> It's better to have a local repo and use this one instead. But if you want 
> I can have a look at it again, maybe I find it now.
>
> Op vrijdag 29 april 2016 17:03:50 UTC+2 schreef Stijn Diependaele:
>>
>> Dear,
>>
>> I'm trying to write a groovy script which manages the JDK installs. 
>>
>> The code below would set the JDK installation with the home folder. 
>> Although I would like to us an automatic installation from Oracle.
>> You have to set the username and password for this. But how do i pass the 
>> username and password to the Descriptor of JDKInstaller?
>>
>> If I look at 
>> http://javadoc.jenkins-ci.org/hudson/tools/JDKInstaller.DescriptorImpl.html 
>> I can see that you can getUsername an getPassword. 
>> A guess would be it's done by passing it through JSON in the configure 
>> method???
>>
>> Could anyone provide a code example? 
>>
>> JDKDesc = Jenkins.instance.getDescriptorByName("hudson.model.JDK");
>>
>> JDK jdk = new JDK("JDK 8", "/usr/lib/jvm/java-8-openjdk-amd64");
>> 
>> jdkDesc.setInstallations(jdk); 
>>
>> jdks = jdkDesc.getInstallations();
>> jdkDesc.save();
>>
>> Jenkins.instance.save()
>>
>> thanks!
>> Stijn
>>
>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/74560e87-be49-4f6d-acd2-38614e80776d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: JDK Installer Groovy script

2016-06-30 Thread Stijn Diependaele
Hey Mike,

We decided not to download from Oracle. Instead we have a local repo and we 
use puppet to manage/install the java package. So I did it like in the 
script above by setting the name and the path where java is installed.

It's better to have a local repo and use this one instead. But if you want 
I can have a look at it again, maybe I find it now.

Op vrijdag 29 april 2016 17:03:50 UTC+2 schreef Stijn Diependaele:
>
> Dear,
>
> I'm trying to write a groovy script which manages the JDK installs. 
>
> The code below would set the JDK installation with the home folder. 
> Although I would like to us an automatic installation from Oracle.
> You have to set the username and password for this. But how do i pass the 
> username and password to the Descriptor of JDKInstaller?
>
> If I look at 
> http://javadoc.jenkins-ci.org/hudson/tools/JDKInstaller.DescriptorImpl.html 
> I can see that you can getUsername an getPassword. 
> A guess would be it's done by passing it through JSON in the configure 
> method???
>
> Could anyone provide a code example? 
>
> JDKDesc = Jenkins.instance.getDescriptorByName("hudson.model.JDK");
>
> JDK jdk = new JDK("JDK 8", "/usr/lib/jvm/java-8-openjdk-amd64");
> 
> jdkDesc.setInstallations(jdk); 
>
> jdks = jdkDesc.getInstallations();
> jdkDesc.save();
>
> Jenkins.instance.save()
>
> thanks!
> Stijn
>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/f7979a4f-2ce0-47ae-aa8c-755068e40a97%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: JDK Installer Groovy script

2016-06-27 Thread Mark Waite
Since Jenkins has an http server delivering content from the userContent
directory, I configured the JDK download location to be the userContent
directory of the Jenkins server.  That allows me to keep the JDK download
self-contained within the Jenkins server, without any scripting.

Mark Waite

On Mon, Jun 27, 2016 at 12:48 PM Mike Albert  wrote:

> Did you ever find a solution for this?  I'm trying to automate the JDK
> installations for a new jenkins server.
>
> Thanks.
>
>
> On Friday, April 29, 2016 at 11:03:50 AM UTC-4, Stijn Diependaele wrote:
>>
>> Dear,
>>
>> I'm trying to write a groovy script which manages the JDK installs.
>>
>> The code below would set the JDK installation with the home folder.
>> Although I would like to us an automatic installation from Oracle.
>> You have to set the username and password for this. But how do i pass the
>> username and password to the Descriptor of JDKInstaller?
>>
>> If I look at
>> http://javadoc.jenkins-ci.org/hudson/tools/JDKInstaller.DescriptorImpl.html
>> I can see that you can getUsername an getPassword.
>> A guess would be it's done by passing it through JSON in the configure
>> method???
>>
>> Could anyone provide a code example?
>>
>> JDKDesc = Jenkins.instance.getDescriptorByName("hudson.model.JDK");
>>
>> JDK jdk = new JDK("JDK 8", "/usr/lib/jvm/java-8-openjdk-amd64");
>>
>> jdkDesc.setInstallations(jdk);
>>
>> jdks = jdkDesc.getInstallations();
>> jdkDesc.save();
>>
>> Jenkins.instance.save()
>>
>> thanks!
>> Stijn
>>
> --
> 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 jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/fa675a23-4388-4ea7-89cf-f84063616f4b%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtEu8ryYfm-OZUrdLaafdn%3DsjQstZtPpxb9rmaDWZBiESA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: JDK Installer Groovy script

2016-06-27 Thread Mike Albert
Did you ever find a solution for this?  I'm trying to automate the JDK 
installations for a new jenkins server.

Thanks.

On Friday, April 29, 2016 at 11:03:50 AM UTC-4, Stijn Diependaele wrote:
>
> Dear,
>
> I'm trying to write a groovy script which manages the JDK installs. 
>
> The code below would set the JDK installation with the home folder. 
> Although I would like to us an automatic installation from Oracle.
> You have to set the username and password for this. But how do i pass the 
> username and password to the Descriptor of JDKInstaller?
>
> If I look at 
> http://javadoc.jenkins-ci.org/hudson/tools/JDKInstaller.DescriptorImpl.html 
> I can see that you can getUsername an getPassword. 
> A guess would be it's done by passing it through JSON in the configure 
> method???
>
> Could anyone provide a code example? 
>
> JDKDesc = Jenkins.instance.getDescriptorByName("hudson.model.JDK");
>
> JDK jdk = new JDK("JDK 8", "/usr/lib/jvm/java-8-openjdk-amd64");
> 
> jdkDesc.setInstallations(jdk); 
>
> jdks = jdkDesc.getInstallations();
> jdkDesc.save();
>
> Jenkins.instance.save()
>
> thanks!
> Stijn
>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/fa675a23-4388-4ea7-89cf-f84063616f4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


JDK Installer Groovy script

2016-04-29 Thread Stijn Diependaele
Dear,

I'm trying to write a groovy script which manages the JDK installs. 

The code below would set the JDK installation with the home folder. 
Although I would like to us an automatic installation from Oracle.
You have to set the username and password for this. But how do i pass the 
username and password to the Descriptor of JDKInstaller?

If I look at 
http://javadoc.jenkins-ci.org/hudson/tools/JDKInstaller.DescriptorImpl.html 
I can see that you can getUsername an getPassword. 
A guess would be it's done by passing it through JSON in the configure 
method???

Could anyone provide a code example? 

JDKDesc = Jenkins.instance.getDescriptorByName("hudson.model.JDK");

JDK jdk = new JDK("JDK 8", "/usr/lib/jvm/java-8-openjdk-amd64");

jdkDesc.setInstallations(jdk); 

jdks = jdkDesc.getInstallations();
jdkDesc.save();

Jenkins.instance.save()

thanks!
Stijn

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/c9780c70-929e-4806-b734-28161f494c6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.