sous-chefs / jenkins

Development repository for the jenkins cookbook
https://supermarket.chef.io/cookbooks/jenkins
Apache License 2.0
424 stars 635 forks source link

jenkins-cli connection mode http WARNING: Warning: -user ignored unless using -ssh #748

Closed olgafandeliuk closed 3 years ago

olgafandeliuk commented 4 years ago

Hello,

Chef-client fails to run on jenkins-master due to inability to set username and password for http connection mode.

When I test it locally, all looks good:

/usr/lib/jvm/java-8-openjdk-amd64/bin/java -jar /var/chef/cache/jenkins-cli.jar -s http://localhost:8080 -http -auth jenkinsusername:jenkinspassword who-am-i
Authenticated as: jenkins-username
Authorities:
  authenticated
  RADIUS
  All Users - LDAP

Cookbooks are set according to the doc:

default['jenkins']['executor']['protocol'] = 'http'
default['jenkins']['executor']['cli_user'] = 'jenkins-username'

But chef-client fails with the following error:

Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '6'
    ---- Begin output of "/usr/lib/jvm/java-8-openjdk-amd64/bin/java" -jar "/var/chef/cache/jenkins-cli.jar" -s http://localhost:8080 -"http" -user "jenkins-username" groovy = ----
    STDOUT:
    STDERR: Jun 15, 2020 10:57:49 AM hudson.cli.CLI _main
    WARNING: Warning: -user ignored unless using -ssh

    ERROR: anonymous is missing the Overall/Read permission
    Jun 15, 2020 10:57:49 AM hudson.cli.CLI$2 run
    WARNING: null
    java.io.IOException: Stream is closed
        at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3591)
        at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3565)
        at java.io.DataOutputStream.writeInt(DataOutputStream.java:197)
        at hudson.cli.PlainCLIProtocol$EitherSide.send(PlainCLIProtocol.java:167)
        at hudson.cli.PlainCLIProtocol$ClientSide.sendEndStdin(PlainCLIProtocol.java:339)
        at hudson.cli.CLI$2.run(CLI.java:328)
    ---- End output of "/usr/lib/jvm/java-8-openjdk-amd64/bin/java" -jar "/var/chef/cache/jenkins-cli.jar" -s http://localhost:8080 -"http" -user "jenkins-username" groovy = ----
    Ran "/usr/lib/jvm/java-8-openjdk-amd64/bin/java" -jar "/var/chef/cache/jenkins-cli.jar" -s http://localhost:8080 -"http" -user "jenkins-username" groovy = returned 6

    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/jenkins/libraries/_executor.rb:87:in `execute!'
    /var/chef/cache/cookbooks/jenkins/libraries/_executor.rb:137:in `groovy!'
    /var/chef/cache/cookbooks/jenkins/libraries/user.rb:101:in `block (2 levels) in <class:JenkinsUser>'
    /var/chef/cache/cookbooks/jenkins/libraries/user.rb:100:in `block in <class:JenkinsUser>'

Remoting mode ssh isn't an option for us. But looks like the cli_user attribute works only for ssh, but not for http

Thanks

github-actions[bot] commented 3 years ago

Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.

github-actions[bot] commented 3 years ago

Closing due to inactivity. If this is still an issue please reopen or open another issue. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.