[JIRA] [docker-workflow-plugin] (JENKINS-29046) NPE when using withDockerRegistry

25 views
Skip to first unread message

gsymons@gsconsulting.biz (JIRA)

unread,
Jun 23, 2015, 5:02:03 PM6/23/15
to jenkinsc...@googlegroups.com
Greg Symons created an issue
 
Jenkins / Bug JENKINS-29046
NPE when using withDockerRegistry
Issue Type: Bug Bug
Assignee: Jesse Glick
Components: docker-workflow-plugin
Created: 23/Jun/15 9:01 PM
Environment: Jenkins 1.609.1

Plugins:
workflow 1.8
docker-workflow 1.0

docker 1.6.2
jenkins itself is running in a docker container; access to docker daemon is through shared host unix socket
Priority: Blocker Blocker
Reporter: Greg Symons

I get a NullPointerException when I try to use the withDockerRegistry step from the docker workflow plugin.

Workflow:

stage 'Build'

node {
    withDockerRegistry(url: 'https://docker-registry.example.com', credentialsId: '69d57484-a048-4ab2-88b1-7483b800bd20') {
      docker.image('docker-registry.example.com/infrastructure/sbt-build').inside {
        checkout([$class: 'MercurialSCM',
                      credentialsId: '69d57484-a048-4ab2-88b1-7483b800bd20', 
                      source:   'https://hg.example.com/my/repo'])
      }
  }
}

Output:

Started by user Greg Symons
Running: Build
Entering stage Build
Proceeding
Running: Allocate node : Start
Running on master in /var/jenkins_home/workspace/mdm-build-mainline
Running: Allocate node : Body : Start
Running: Sets up Docker registry endpoint : Start
Running: Sets up Docker registry endpoint : End
Running: Allocate node : Body : End
Running: Allocate node : End
Running: End of Workflow
java.lang.NullPointerException
	at org.jenkinsci.plugins.docker.workflow.RegistryEndpointStep$Execution.newKeyMaterialFactory(RegistryEndpointStep.java:61)
	at org.jenkinsci.plugins.docker.workflow.AbstractEndpointStepExecution.start(AbstractEndpointStepExecution.java:44)
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:136)
	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:4)
	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:106)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:79)
	at sun.reflect.GeneratedMethodAccessor122.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.ClosureBlock.eval(ClosureBlock.java:25)
	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:271)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:71)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:180)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:178)
	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Finished: FAILURE
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

jglick@cloudbees.com (JIRA)

unread,
Jul 28, 2015, 5:53:01 PM7/28/15
to jenkinsc...@googlegroups.com
Jesse Glick resolved as Not A Defect
 

Source

You are passing unrecognized parameters url and credentialsId and not passing the mandatory parameter registry; basically missing [] around the arguments.

Anyway this step is not designed for end users. Use docker.withRegistry instead, as covered by the inline documentation in Snippet Generator, as well as the manual.

Change By: Jesse Glick
Status: Open Resolved
Resolution: Not A Defect

kennedy.tracy@yahoo.com (JIRA)

unread,
Aug 3, 2015, 4:56:02 PM8/3/15
to jenkinsc...@googlegroups.com
Tracy Kennedy commented on Bug JENKINS-29046
 
Re: NPE when using withDockerRegistry

Jesse Glick The snippet generator is actually generating the "withDockerRegistry([])" step. It's under the Advanced/Deprecated section as "Sets up Docker registry endpoint".

jglick@cloudbees.com (JIRA)

unread,
Aug 3, 2015, 6:28:02 PM8/3/15
to jenkinsc...@googlegroups.com

Tracy Kennedy not following what you are saying. Yes the withDockerRegistry step is listed in Snippet Generator, with documentation explaining that you normally should not use it, and referring you to the docker DSL global variable instead. If you insist on using the step directly anyway, you can use the Snippet Generator to get an example syntax.

kennedy.tracy@yahoo.com (JIRA)

unread,
Aug 4, 2015, 11:08:01 AM8/4/15
to jenkinsc...@googlegroups.com

Jesse Glick I meant that even though this step is not meant for end users per the docs, the snippet generator lists it as an option for registering a Docker registry under the "Advanced/Deprecated" section. I assume `withDockerRegistry` falls under the latter category, but that distinction might not be obvious enough for a newbie who is experimenting and hasn't read the docs yet.

Perhaps the Advanced/Deprecated sections should be broken out into separate listings, with `withDockerRegistry` clearly plopped into the deprecated section and the preferred `docker.withRegistry` under the Advanced section.

jglick@cloudbees.com (JIRA)

unread,
Aug 12, 2015, 4:13:02 PM8/12/15
to jenkinsc...@googlegroups.com

docker.withRegistry is not “advanced”, it is an advertised feature under the docker global variable, the entry point for all functionality in this plugin.

Reply all
Reply to author
Forward
0 new messages