简体   繁体   中英

STDERR: java.io.IOException: Failed to copy git to /var/lib/jenkins/plugins/git.jpi

This is related to anyone who is using chef to install jenkins and jenkins plugins.
I am getting this error when I am trying to install the 'git' plugin using the opscode-cookbooks/jenkins cookbook.

     Mixlib::ShellOut::ShellCommandFailed
     ------------------------------------
     Expected process to exit with [0], but received '255'
     ---- Begin output of java -jar /var/chef/cache/jenkins-cli.jar -s http://localhost:8080 install-plugin git  ----
     STDOUT: Installing a plugin from local file: git
     STDERR: java.io.IOException: Failed to copy git to /var/lib/jenkins/plugins/git.jpi
        at hudson.FilePath.copyTo(FilePath.java:1989)
        at hudson.cli.InstallPluginCommand.run(InstallPluginCommand.java:85)
        at hudson.cli.CLICommand.main(CLICommand.java:237)
        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:326)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:301)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:260)
        at hudson.remoting.UserRequest.perform(UserRequest.java:121)
        at hudson.remoting.UserRequest.perform(UserRequest.java:49)
        at hudson.remoting.Request$2.run(Request.java:325)
        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)
     Caused by: java.io.IOException: remote file operation failed: git at hudson.remoting.Channel@3ca34885:CLI channel from /127.0.0.1: java.io.FileNotFoundException: git (Is a directory)
        at hudson.FilePath.act(FilePath.java:985)
        at hudson.FilePath.act(FilePath.java:967)
        at hudson.FilePath.copyTo(FilePath.java:2010)
        at hudson.FilePath.copyTo(FilePath.java:1984)
        ... 22 more
     Caused by: java.io.FileNotFoundException: git (Is a directory)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:146)
        at hudson.FilePath$41.invoke(FilePath.java:2015)
        at hudson.FilePath$41.invoke(FilePath.java:2010)
        at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2688)
        at hudson.remoting.UserRequest.perform(UserRequest.java:121)
        at hudson.remoting.UserRequest.perform(UserRequest.java:49)
        at hudson.remoting.Request$2.run(Request.java:325)
        at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
        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)
        at ......remote call to CLI channel from /127.0.0.1(Native Method)
        at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1360)
        at hudson.remoting.UserResponse.retrieve(UserRequest.java:221)
        at hudson.remoting.Channel.call(Channel.java:753)
        at hudson.FilePath.act(FilePath.java:978)
        ... 25 more
     ---- End output of java -jar /var/chef/cache/jenkins-cli.jar -s http://localhost:8080 install-plugin git  ----
     Ran java -jar /var/chef/cache/jenkins-cli.jar -s http://localhost:8080 install-plugin git  returned 255

     Cookbook Trace:
     ---------------
     /var/chef/cache/cookbooks/jenkins/libraries/_executor.rb:79:in `execute!'
     /var/chef/cache/cookbooks/jenkins/libraries/plugin.rb:125:in `block (2 levels) in <class:JenkinsPlugin>'
     /var/chef/cache/cookbooks/jenkins/libraries/plugin.rb:137:in `block in <class:JenkinsPlugin>'

     Resource Declaration:
     ---------------------
     # In /var/chef/cache/cookbooks/prsn_jenkins/recipes/plugins.rb

       3:   jenkins_plugin plugin if flag
       4: end

     Compiled Resource:
     ------------------
     # Declared in /var/chef/cache/cookbooks/prsn_jenkins/recipes/plugins.rb:3:in `block in from_file'

     jenkins_plugin("git") do
       action :install
       retries 0
       retry_delay 2
       guard_interpreter :default
       cookbook_name "prsn_jenkins"
       recipe_name "plugins"
       version :latest
     end

my cookbook uses the opscode-cookbook/jenkins. Here is how my cookbook looks like:

Attribute file:

  default['plugin_jenkins']['plugins'] =  { 'active-directory' => {:enable => true}, 'git-client' => {:enable => true}, 'git' => {:enable => true} }

Recipe file:

node['plugin_jenkins']['plugins'].each do |plugin, flag|
  jenkins_plugin plugin if flag
end 

If you are using the opscode-cookbooks/jenkins, you should consider upgrading that cookbook. The latest cookbook(v2.3.1) seem to resolve this issue!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM