jenkins icon indicating copy to clipboard operation
jenkins copied to clipboard

jenkins_private_key_credentials Converge failure after Jenkins upgrade

Open veetow opened this issue 8 years ago • 2 comments

Cookbook version

2.4.1

Chef-client version

12.4.3

Platform Details

CentOS 6.6

Scenario:

jenkins_private_key_credentials 'jenkins-ssh-key' do
  description 'Stash credentials for Jenkins (SSH private key)'
  username vault_data['jenkins-ssh-user']
  private_key vault_data['jenkins-ssh-private']
  id 'beefcafe-17a1-43ba-a4ae-c491ab15ce5c'
end

Steps to Reproduce:

Jenkins v2.8 Plain Credentials Plugin v1.1 SSH Agent Plugin v1.3 SSH Credentials Plugin 1.11

Expected Result:

Expect the private key credentials to be created and the cookbook to converge.

Actual Result:

    ================================================================================
    Error executing action `create` on resource 'jenkins_private_key_credentials[jenkins-ssh-key]'
    ================================================================================

    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/groovy20160609-13547-njnkk0 ----
    STDOUT:
    STDERR: ERROR: Unexpected exception occurred while performing groovy command.
    groovy.lang.MissingPropertyException: No such property: privateKey for class: com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
        at org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:66)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:296)
        at RemoteClass.run(RemoteClass:35)
        at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:263)
        at groovy.lang.GroovyShell.run(GroovyShell.java:518)
        at groovy.lang.GroovyShell.run(GroovyShell.java:497)
        at hudson.cli.GroovyCommand.run(GroovyCommand.java:86)
        at hudson.cli.CLICommand.main(CLICommand.java:257)
        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:884)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:859)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:818)
        at hudson.remoting.UserRequest.perform(UserRequest.java:152)
        at hudson.remoting.UserRequest.perform(UserRequest.java:50)
        at hudson.remoting.Request$2.run(Request.java:332)
        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/groovy20160609-13547-njnkk0 ----
    Ran "java" -jar "/var/chef/cache/jenkins-cli.jar" -s http://localhost:8080 groovy /tmp/groovy20160609-13547-njnkk0 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/credentials.rb:209:in `current_credentials'
    /var/chef/cache/cookbooks/jenkins/libraries/credentials_private_key.rb:121:in `current_credentials'
    /var/chef/cache/cookbooks/jenkins/libraries/credentials.rb:83:in `load_current_resource'
    /var/chef/cache/cookbooks/jenkins/libraries/credentials_private_key.rb:73:in `load_current_resource'

    Resource Declaration:
    ---------------------
    suppressed sensitive resource output

    Compiled Resource: 
    ------------------ 
    suppressed sensitive resource output

veetow avatar Jun 09 '16 20:06 veetow

+1, ran into this issue also. Put some really bad not_if code around it in the short term.

LuneraSteve avatar Mar 28 '17 17:03 LuneraSteve

+1

rsluzhynskyy avatar Apr 03 '17 20:04 rsluzhynskyy