Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/jenkins/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 无法在Jenkins上配置Nodejs插件的Groovy脚本_Node.js_Jenkins_Groovy_Jenkins Plugins_Chef Recipe - Fatal编程技术网

Node.js 无法在Jenkins上配置Nodejs插件的Groovy脚本

Node.js 无法在Jenkins上配置Nodejs插件的Groovy脚本,node.js,jenkins,groovy,jenkins-plugins,chef-recipe,Node.js,Jenkins,Groovy,Jenkins Plugins,Chef Recipe,我觉得我遗漏了一些东西,Nodejs插件的数据绑定构造函数上写着“List extensed hudson.tools.ToolProperty properties” 导入jenkins.model* 导入hudson.tools* 导入jenkins.plugins.nodejs.tools* def inst=Jenkins.getInstance() def desc=inst.getDescriptor(jenkins.plugins.nodejs.NodeJSInstaller) d

我觉得我遗漏了一些东西,Nodejs插件的数据绑定构造函数上写着“List extensed hudson.tools.ToolProperty properties”

导入jenkins.model*
导入hudson.tools*
导入jenkins.plugins.nodejs.tools*
def inst=Jenkins.getInstance()
def desc=inst.getDescriptor(jenkins.plugins.nodejs.NodeJSInstaller)
def sinst=new NodeJSInstallation(“nodejs12”,“usr/local/bin/node/”)
说明设置安装(sinst)
描述保存()
错误:
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
预期进程将与[0]一起退出,但收到“1”
----开始输出“java”-jar”/var/chef/cache/jenkins cli.jar”-s http:/
/本地主机:8080Groovy/tmp/groovy20160225-23006-1a7g9ix----
标准:
STDERR:错误:执行groovy命令时发生意外异常
.
groovy.lang.MissingPropertyException:没有这样的属性:类:RemoteClass的Jenkins
位于org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
位于org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
位于org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
在RemoteClass.run处(RemoteClass:6)
位于groovy.lang.GroovyShell.RunScriptorManorteStorRunnable(GroovyShell.java:266)
运行(GroovyShell.java:517)
运行(GroovyCommand.java:86)
位于hudson.cli.CLICommand.main(CLICommand.java:256)
位于hudson.cli.CliManagerImpl.main(CliManagerImpl.java:92)
在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处
在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)中
在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)中
位于java.lang.reflect.Method.invoke(Method.java:606)
在hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:608)
在hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:583)
在hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:542)
在hudson.remoting.UserRequest.perform(UserRequest.java:120)
在hudson.remoting.UserRequest.perform(UserRequest.java:48)
在hudson.remoting.Request$2.run(Request.java:326)
在hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
在hudson.cli.CliManagerImpl$1.call(CliManagerImpl.java:63)
调用(CallableDecoratorAdapter.java:18)
在hudson.remoting.CallableDecoratorList$1.call(CallableDecoratorList.java:21)
在jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
在java.util.concurrent.FutureTask.run(FutureTask.java:262)处
位于java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
位于java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
运行(Thread.java:745)
----“java”-jar”/var/chef/cache/jenkins cli.jar”-s的结束输出http://localhost:8080 groovy/tmp/Groovy2016 0225-23006-1a7g9ix----
运行“java”-jar”/var/chef/cache/jenkins cli.jar”-shttp://localhost:8080 groovy/tmp/groovy20160225-23006-1a7g9ix返回1
食谱跟踪:
---------------
/var/chef/cache/cookbooks/jenkins/libraries/_executor.rb:84:in'execute!'
/var/chef/cache/cookbooks/jenkins/libraries/_executor.rb:137:in'groovy!'
/var/chef/cache/cookbooks/jenkins/libraries/script.rb:48:in'block(2层)in'
/var/chef/cache/cookbooks/jenkins/libraries/script.rb:47:in'block-in'
资源声明:
---------------------
#在/var/chef/cache/cookbooks/jenkins/recipes/nodeconfig.rb中
3:jenkins_脚本“nodejs”do

4:jenkins上nodejs插件的命令Groovy脚本

导入hudson.model*
导入hudson.tools*
导入jenkins.plugins.nodejs.tools*
导入jenkins.model*
def inst=Jenkins.getInstance()
def desc=inst.getDescriptor(jenkins.plugins.nodejs.tools.NodeJSInstallation)
def安装程序=新的NodeJSInstaller(“NodeJS版本”、“某些npm包”、npm包刷新小时数(整数))
def prop=新的InstallSourceProperty([installer])
def sinst=new NodeJSInstallation(“安装名称(字符串标记)”,“/path/to/nodejs/executable”,[prop])
说明设置安装(sinst)
描述保存()
import jenkins.model.*
import hudson.tools.*
import jenkins.plugins.nodejs.tools.*

def inst = Jenkins.getInstance()

def desc = inst.getDescriptor(jenkins.plugins.nodejs.NodeJSInstaller)

def sinst = new NodeJSInstallation("nodejs12", "/usr/local/bin/node/")

desc.setInstallations(sinst)

desc.save()

Error:

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '1'
    ---- Begin output of "java" -jar "/var/chef/cache/jenkins-cli.jar" -s http:/
    /localhost:8080 groovy /tmp/groovy20160225-23006-1a7g9ix ----
    STDOUT:
    STDERR: ERROR: Unexpected exception occurred while performing groovy command
.
    groovy.lang.MissingPropertyException: No such property: Jenkins for class: RemoteClass 
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
        at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
        at RemoteClass.run(RemoteClass:6)
        at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:266)
        at groovy.lang.GroovyShell.run(GroovyShell.java:517)
        at hudson.cli.GroovyCommand.run(GroovyCommand.java:86)
        at hudson.cli.CLICommand.main(CLICommand.java:256)
        at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:92)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:608)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:583)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:542)
        at hudson.remoting.UserRequest.perform(UserRequest.java:120)
        at hudson.remoting.UserRequest.perform(UserRequest.java:48)
        at hudson.remoting.Request$2.run(Request.java:326)
        at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
        at hudson.cli.CliManagerImpl$1.call(CliManagerImpl.java:63)
        at hudson.remoting.CallableDecoratorAdapter.call(CallableDecoratorAdapter.java:18)
        at hudson.remoting.CallableDecoratorList$1.call(CallableDecoratorList.java:21)
        at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
    ---- End output of "java" -jar "/var/chef/cache/jenkins-cli.jar" -s http://localhost:8080 groovy /tmp/groovy20160225-23006-1a7g9ix ----
    Ran "java" -jar "/var/chef/cache/jenkins-cli.jar" -s http://localhost:8080 groovy /tmp/groovy20160225-23006-1a7g9ix returned 1

    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/jenkins/libraries/_executor.rb:84:in `execute!'
    /var/chef/cache/cookbooks/jenkins/libraries/_executor.rb:137:in `groovy!'
    /var/chef/cache/cookbooks/jenkins/libraries/script.rb:48:in `block (2 levels) in <class:JenkinsScript>'
    /var/chef/cache/cookbooks/jenkins/libraries/script.rb:47:in `block in <class:JenkinsScript>'

    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/jenkins/recipes/nodeconfig.rb

      3: jenkins_script 'nodejs' do
      4:   command <<-EOH.gsub(/^ {4}/, '')
      5:
      6: import hudson.model.*
      7: import hudson.tools.*
      8: import jenkins.plugins.nodejs.tools.*
      9:
     10: def inst = Jenkins.getInstance()
     11:
     12: def desc = inst.getDescriptor(jenkins.plugins.nodejs.NodeJSInstaller)
     13:
     14: def sinst = new NodeJSInstallation("nodejs12", "/usr/local/bin/node")
     15:
     16: desc.setInstallations(sinst)
     17:
     18: desc.save()
     19:
     20: EOH
     21: end