Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin installation fails via jenkins_plugin action #614

Closed
isuftin opened this issue May 12, 2017 · 4 comments
Closed

Plugin installation fails via jenkins_plugin action #614

isuftin opened this issue May 12, 2017 · 4 comments

Comments

@isuftin
Copy link

isuftin commented May 12, 2017

When using the jenkins_plugin action with a named plugin, Jenkins CLI fails to install the plugin seemingly because of an inability to read the file path URI as a valid path.

See output at bottom.

I am also able to log into the VM and manually run the failing command:

"/usr/lib/jvm/java/bin/java" -jar "/tmp/kitchen/cache/jenkins-cli.jar" -s http://localhost:8080 -"ssh" -user "jenkins" install-plugin /tmp/kitchen/cache/display-url-api-2.0.plugin -name display-url-api
May 12, 2017 1:13:48 PM org.apache.sshd.common.util.SecurityUtils register
INFO: BouncyCastle not registered, using the default JCE provider
May 12, 2017 1:13:49 PM hudson.cli.SSHCLI$1 verifyServerKey
WARNING: Unknown host key for localhost/127.0.0.1:46881
/tmp/kitchen/cache/display-url-api-2.0.plugin is neither a valid file, URL, nor a plugin artifact name in the update center

ERROR: Error occurred, see previous output.

However, if I add file:// to the beginning of the path to the plugin on the VM, it works:

"/usr/lib/jvm/java/bin/java" -jar "/tmp/kitchen/cache/jenkins-cli.jar" -s http://localhost:8080 -"ssh" -user "jenkins" install-plugin file:///tmp/kitchen/cache/display-url-api-2.0.plugin -name display-url-api
May 12, 2017 1:14:01 PM org.apache.sshd.common.util.SecurityUtils register
INFO: BouncyCastle not registered, using the default JCE provider
May 12, 2017 1:14:01 PM org.apache.sshd.client.keyverifier.DefaultKnownHostsServerKeyVerifier reloadKnownHosts
WARNING: reloadKnownHosts(/home/vagrant/.ssh/known_hosts) invalid file permissions: Permissions violation (GROUP_WRITE)
May 12, 2017 1:14:01 PM hudson.cli.SSHCLI$1 verifyServerKey
WARNING: Unknown host key for localhost/127.0.0.1:46881
Installing a plugin from file:/tmp/kitchen/cache/display-url-api-2.0.plugin

Cookbook version

5.0.1

Chef-client version

13.0.118

Platform Details

CentOS 6.8 VM in VirtualBox. Running on MacOS 10.10.x

Scenario:

Running Jenkins server created via the Jenkins cookbook. SSHd service is running (though this fails via http protocol as well).

Steps to Reproduce:

Run action:

jenkins_plugin 'display-url-api' do
    version '2.0'
    install_deps true
    notifies :restart, 'service[jenkins]', :delayed
  end

Expected Result:

Plugin is installed

Actual Result:

           ================================================================================
           Error executing action `install` on resource 'jenkins_plugin[display-url-api]'
           ================================================================================

           Mixlib::ShellOut::ShellCommandFailed
           ------------------------------------
           Expected process to exit with [0], but received '5'
           ---- Begin output of "/usr/lib/jvm/java/bin/java" -jar "/tmp/kitchen/cache/jenkins-cli.jar" -s http://localhost:8080 -"ssh" -user "jenkins" install-plugin /tmp/kitchen/cache/display-url-api-2.0.plugin -name display-url-api  ----
           STDOUT: /tmp/kitchen/cache/display-url-api-2.0.plugin is neither a valid file, URL, nor a plugin artifact name in the update center
           STDERR: May 12, 2017 1:06:29 PM org.apache.sshd.common.util.SecurityUtils register
           INFO: BouncyCastle not registered, using the default JCE provider
           May 12, 2017 1:06:29 PM hudson.cli.SSHCLI$1 verifyServerKey
           WARNING: Unknown host key for localhost/127.0.0.1:46881

           ERROR: Error occurred, see previous output.
           ---- End output of "/usr/lib/jvm/java/bin/java" -jar "/tmp/kitchen/cache/jenkins-cli.jar" -s http://localhost:8080 -"ssh" -user "jenkins" install-plugin /tmp/kitchen/cache/display-url-api-2.0.plugin -name display-url-api  ----
           Ran "/usr/lib/jvm/java/bin/java" -jar "/tmp/kitchen/cache/jenkins-cli.jar" -s http://localhost:8080 -"ssh" -user "jenkins" install-plugin /tmp/kitchen/cache/display-url-api-2.0.plugin -name display-url-api  returned 5

           Cookbook Trace:
           ---------------
           /tmp/kitchen/cache/cookbooks/jenkins/libraries/_executor.rb:87:in `execute!'
           /tmp/kitchen/cache/cookbooks/jenkins/libraries/plugin.rb:317:in `install_plugin_from_url'
           /tmp/kitchen/cache/cookbooks/jenkins/libraries/plugin.rb:289:in `install_plugin_from_update_center'
           /tmp/kitchen/cache/cookbooks/jenkins/libraries/plugin.rb:124:in `block (2 levels) in <class:JenkinsPlugin>'
           /tmp/kitchen/cache/cookbooks/jenkins/libraries/plugin.rb:154:in `block in <class:JenkinsPlugin>'

           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/owi_jenkins/recipes/plugins.rb

            15:   jenkins_plugin plugin do
            16:     version version if version
            17:     install_deps true
            18:     notifies :restart, 'service[jenkins]', :delayed
            19:   end
            20: end

           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/owi_jenkins/recipes/plugins.rb

            15:   jenkins_plugin plugin do
            16:     version version if version
            17:     install_deps true
            18:     notifies :restart, 'service[jenkins]', :delayed
            19:   end
            20: end

           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cache/cookbooks/owi_jenkins/recipes/plugins.rb:15:in `block in from_file'

           jenkins_plugin("display-url-api") do
             action [:install]
             default_guard_interpreter :default
             declared_type :jenkins_plugin
             cookbook_name "owi_jenkins"
             recipe_name "plugins"
             version "2.0"
             install_deps true
           end

           System Info:
           ------------
           chef_version=13.0.118
           platform=centos
           platform_version=6.8
           ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
           program_name=chef-client worker: ppid=10770;start=13:06:20;
           executable=/opt/chef/bin/chef-client

       ---- Begin output of "/usr/lib/jvm/java/bin/java" -jar "/tmp/kitchen/cache/jenkins-cli.jar" -s http://localhost:8080 -"ssh" -user "jenkins" install-plugin /tmp/kitchen/cache/display-url-api-2.0.plugin -name display-url-api  ----
       STDOUT: /tmp/kitchen/cache/display-url-api-2.0.plugin is neither a valid file, URL, nor a plugin artifact name in the update center
       STDERR: May 12, 2017 1:06:29 PM org.apache.sshd.common.util.SecurityUtils register
       INFO: BouncyCastle not registered, using the default JCE provider
       May 12, 2017 1:06:29 PM hudson.cli.SSHCLI$1 verifyServerKey
       WARNING: Unknown host key for localhost/127.0.0.1:46881

       ERROR: Error occurred, see previous output.
       ---- End output of "/usr/lib/jvm/java/bin/java" -jar "/tmp/kitchen/cache/jenkins-cli.jar" -s http://localhost:8080 -"ssh" -user "jenkins" install-plugin /tmp/kitchen/cache/display-url-api-2.0.plugin -name display-url-api  ----
@cmoscardi
Copy link
Contributor

+1, also was able to run the command by prepending file://

@cmoscardi
Copy link
Contributor

The offending function:

https://github.com/chef-cookbooks/jenkins/blob/master/libraries/plugin.rb#L302

Something must be stripping out the file:/// URI there

@tdigangi5
Copy link

Is there any release timeline for this release? Or a work around that I can use directly in the jenkins cookbook wrapper? The file:// issue is preventing me from finishing my task!

@tas50
Copy link
Contributor

tas50 commented Jul 4, 2017

This has been released. Give it a try and open this back up if it's still a problem.

@tas50 tas50 closed this as completed Jul 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants