-
-
Save arbabnazar/052e056a077e18fcfe6c333537f18eb1 to your computer and use it in GitHub Desktop.
Jenkins init.groovy.d Nodejs installer script
This file contains hidden or 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