Apostolos Fanakis
5 years ago
5 changed files with 33 additions and 34 deletions
@ -1,29 +0,0 @@ |
|||
import hudson.model.JDK |
|||
|
|||
import hudson.tools.InstallSourceProperty |
|||
|
|||
import hudson.tools.ZipExtractionInstaller |
|||
|
|||
def descriptor = new JDK.DescriptorImpl(); |
|||
|
|||
def List<JDK> installations = [] |
|||
|
|||
javaTools=[['name':'jdk8', 'url':'file:/var/jenkins_home/downloads/jdk-8u131-linux-x64.tar.gz', 'subdir':'jdk1.8.0_131'], |
|||
|
|||
['name':'jdk7', 'url':'file:/var/jenkins_home/downloads/jdk-7u76-linux-x64.tar.gz', 'subdir':'jdk1.7.0_76']] |
|||
|
|||
javaTools.each { javaTool -> |
|||
|
|||
println("Setting up tool: ${javaTool.name}") |
|||
|
|||
def installer = new ZipExtractionInstaller(javaTool.label as String, javaTool.url as String, javaTool.subdir as String); |
|||
|
|||
def jdk = new JDK(javaTool.name as String, null, [new InstallSourceProperty([installer])]) |
|||
|
|||
installations.add(jdk) |
|||
|
|||
} |
|||
|
|||
descriptor.setInstallations(installations.toArray(new JDK[installations.size()])) |
|||
|
|||
descriptor.save() |
@ -0,0 +1,25 @@ |
|||
#!/usr/bin/env groovy |
|||
import hudson.tools.InstallSourceProperty |
|||
import jenkins.model.Jenkins |
|||
import jenkins.plugins.nodejs.tools.NodeJSInstallation |
|||
import jenkins.plugins.nodejs.tools.NodeJSInstaller |
|||
import static jenkins.plugins.nodejs.tools.NodeJSInstaller.DEFAULT_NPM_PACKAGES_REFRESH_HOURS |
|||
|
|||
final versions = [ |
|||
'NodeJS 13.x': '13.10.1' |
|||
] |
|||
|
|||
final globalPackages = "eslint@~6.8.0" |
|||
|
|||
Jenkins.instance.getDescriptor(NodeJSInstallation).with { |
|||
installations = versions.collect { |
|||
new NodeJSInstallation(it.key, null, [ |
|||
new InstallSourceProperty([ |
|||
new NodeJSInstaller( |
|||
it.value, |
|||
globalPackages, |
|||
DEFAULT_NPM_PACKAGES_REFRESH_HOURS) |
|||
]) |
|||
]) |
|||
} as NodeJSInstallation[] |
|||
} |
Loading…
Reference in new issue