[workflow-plugin] svn credentials problem when running on a remote node

484 views
Skip to first unread message

Stefan Lorenz

unread,
Dec 9, 2014, 5:40:18 PM12/9/14
to jenkins...@googlegroups.com
Hi,

Is it possible to get AdditionalCredentials from the SubversionSCM into a workflow, because I always get this:

Caused by: org.tmatesoft.svn.core.SVNCancelException: svn: E200015: OPTIONS ...
Caused by: org.tmatesoft.svn.core.SVNCancelException: svn: E200015: No credential to try. Authentication failed


My build step looks like that:


checkout scm: [$class: 'SubversionSCM', locations: [new hudson.scm.SubversionSCM.ModuleLocation('http://svn.repo.foo/bar/trunk', ".")], additionalCredentials: [new hudson.scm.SubversionSCM.AdditionalCredentials('<http://svn.repo.foo:80> Foo Subversion Repository', 'svn.repo.foo')]]

Can this work?
Or is there a example how to handle that?


Thx
Stefan


Jennifer Hofmeister

unread,
Dec 17, 2014, 3:53:22 AM12/17/14
to jenkins...@googlegroups.com

Hi Stefan,

 

did you add credentials in the checkout step, or only in the Addtional Credentials part? It’s necessary to specify them in both places. 

 

If the problem doesn’t go away, maybe https://issues.jenkins-ci.org/browse/JENKINS-22542 can provide some solutions for you.

 

Cheers

 

Jennifer

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/4aa5bda3-ccd6-4004-8345-a8c7f67e6445%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Stefan Lorenz

unread,
Dec 17, 2014, 7:09:23 AM12/17/14
to jenkins...@googlegroups.com, jennifer....@younicos.com
Hi,

I used the wrong syntax in the workflow-plugin

I'm using this now:

checkout scm: new hudson.scm.SubversionSCM('http://svn.repo.de/foo/trunk', '123-123-123-123', '.')

It's the wrong/depcated constructor probably but it works now...

thx for your response

Kohsuke Kawaguchi

unread,
Dec 17, 2014, 9:38:36 AM12/17/14
to jenkins...@googlegroups.com, Jesse Glick
So in your working version how do you specify the AdditionalCredentials instance? And how come you don't have the credentialId? I have a feeling that what you really wanted is just to pass in credentials, not so much "additionalCredentials":

Assuming that, I'd rewrite your following script:

checkout scm: new hudson.scm.SubversionSCM('http://svn.repo.de/foo/trunk', '123-123-123-123', '.')

... into this:

checkout scm: [ $class: "SubversionSCM", locations: [ remote:'http://svn.repo.de/foo/trunk', credentialsId:'123-123-123-123' ] ]

This version relies less on a specific constructor. (I haven't verifieid if generic SCM step can get the databinding of nested ModuleLocation done like this, but I believe Jesse implemented this some time ago.)

Right now, the best way to get to snippet like this is to use the snippet generator, so I need to check if it does that. Given your question, I assume it didn't.

Beyond that I also think we need more docs (probably auto-generated form the source code as opposed to manually authored to prevent it from getting out of sync), something like what Chef does, so that a simple common case like this can be readily looked up from examples.

When I write Chef recipes I look at these docs all the time, and the same for Maven.



For more options, visit https://groups.google.com/d/optout.


--
Kohsuke Kawaguchi

Stefan Lorenz

unread,
Dec 17, 2014, 2:08:43 PM12/17/14
to jenkins...@googlegroups.com, jgl...@cloudbees.com
Thx again, 
and yes, you are right...

I never realized that the snippet generator is so comfortable... :-9

I haven't used it, so I ended up in a try and error session...

A documentation like Chef would be nice, 
but for me, I think I just have to get a bit more into Groovy and understand how the databinding, paramter and steps are working in the workflow-plugin :-)


The plugin, I think, is a huge improvement for Jenkins,
thx 

Ken DeLong

unread,
Jan 29, 2015, 8:24:25 PM1/29/15
to jenkins...@googlegroups.com, jgl...@cloudbees.com
This is my first workflow project and I'm having trouble checking out my project from Subversion.  I'm using the Docker image of 1.580.2.

I am trying that syntax:
    checkout scm: [ $class: "SubversionSCM", locations: [ remote:'http://svn.repo.de/foo/trunk', credentialsId:'123-123-123-123' ] ]

But I am getting a stacktrace:
java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class
	at org.jenkinsci.plugins.workflow.structs.DescribableHelper.coerce(DescribableHelper.java:161)
	at org.jenkinsci.plugins.workflow.structs.DescribableHelper.buildArguments(DescribableHelper.java:133)
	at org.jenkinsci.plugins.workflow.structs.DescribableHelper.instantiate(DescribableHelper.java:81)
	at org.jenkinsci.plugins.workflow.structs.DescribableHelper.coerce(DescribableHelper.java:183)
	at org.jenkinsci.plugins.workflow.structs.DescribableHelper.buildArguments(DescribableHelper.java:133)
	at org.jenkinsci.plugins.workflow.structs.DescribableHelper.instantiate(DescribableHelper.java:81)
	at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:95)
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:133)
	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:98)
	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:15)
	at WorkflowScript.run(WorkflowScript:3)
	at Unknown.Unknown(Unknown)
	at ___cps.transform___(Native Method)
	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:69)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:100)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:76)
	at sun.reflect.GeneratedMethodAccessor327.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
	at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
	at sun.reflect.GeneratedMethodAccessor363.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
	at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
	at sun.reflect.GeneratedMethodAccessor363.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
	at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
	at sun.reflect.GeneratedMethodAccessor363.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
	at com.cloudbees.groovy.cps.Next.step(Next.java:58)
	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:145)
	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:164)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:267)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:70)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:176)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:174)
	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:111)
	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	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)

My entire script is:

node {
  checkout scm: [ $class: "SubversionSCM", locations: [ remote:'https://mysvn/myrepo/trunk', credentialsId: '9c46a078-536d-419a-8baa-36aeaf8c7a1d' ] ]
  def mvnHome = tool 'Maven 3.2.5'
  sh "${mvnHome}/bin/mvn clean test"
}

Any idea how to fix?

Jesse Glick

unread,
Feb 25, 2015, 6:00:57 PM2/25/15
to jenkins...@googlegroups.com, jgl...@cloudbees.com
On Thursday, January 29, 2015 at 8:24:25 PM UTC-5, Ken DeLong wrote:
java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class
	at org.jenkinsci.plugins.workflow.structs.DescribableHelper.coerce(DescribableHelper.java:161)

I have not seen this. Please file a bug in JIRA mentioning plugin versions of Workflow and Subversion, attaching a sample script to reproduce the problem and the stack trace.

Ken DeLong

unread,
Feb 25, 2015, 11:12:27 PM2/25/15
to jenkins...@googlegroups.com
Hi Jesse,

I just created a bug the other day:


Let me know if there's information missing that you need.

Ken


--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/GCLYCl7q_fI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/2cf78f1b-91fc-4cc1-b48b-db83284b76e7%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages