Last active
November 29, 2017 08:51
-
-
Save mllrjb/8c8c30d9bd54532bf6e6a62031e7e3a6 to your computer and use it in GitHub Desktop.
Jenkins init.groovy.d Nodejs installer script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jenkins.model.* | |
import hudson.model.* | |
import jenkins.plugins.nodejs.tools.* | |
import hudson.tools.* | |
def inst = Jenkins.getInstance() | |
def desc = inst.getDescriptor("jenkins.plugins.nodejs.tools.NodeJSInstallation") | |
def versions = [ | |
"nodejs-6.x": "6.7.0", | |
"nodejs-4.x": "4.6.0", | |
] | |
def installations = []; | |
for (v in versions) { | |
def installer = new NodeJSInstaller(v.value, "", 100) | |
def installerProps = new InstallSourceProperty([installer]) | |
def installation = new NodeJSInstallation(v.key, "", [installerProps]) | |
installations.push(installation) | |
} | |
desc.setInstallations(installations.toArray(new NodeJSInstallation[0])) | |
desc.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment