Skip to content
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.

On a nodejs workflow, I get an error at the kubernetes.image().withName(clusterImageNameWithoutTag).push().withTag(newVersion).toRegistry() #5674

Closed
jmlambert78 opened this issue Jan 29, 2016 · 3 comments

Comments

@jmlambert78
Copy link

The error occurs on the default template as well as my project one 👍 https://github.com/jmlambert78/node-example
Thx

Creating tar from path: ..Building image:null:null/fabric8io/nodejstest:e45e017 from path:..

Step 0 : FROM node:5.3-onbuild

�[91m# Executing 3 build triggers

�[0m

Trigger 0, COPY package.json /usr/src/app/

Step 0 : COPY package.json /usr/src/app/

---> Using cache

Trigger 1, RUN npm install

Step 0 : RUN npm install

---> Using cache

Trigger 2, COPY . /usr/src/app

Step 0 : COPY . /usr/src/app

---> b8fd5227867c

Removing intermediate container 8424dee491e4

Successfully built b8fd5227867c

[Workflow] pushImage

Pushing image:null:null/fabric8io/nodejstest to docker registry.

ERROR: Resource temporarily unavailable at Socket[addr=0.0.0.0/0.0.0.0,port=0,localport=0][fd=java.io.FileDescriptor@260c8928; file=/run/docker.sock; connected=true; bound=false]

[Workflow] } //node

[Workflow] Allocate node : End

[Workflow] End of Workflow

java.lang.RuntimeException: java.lang.RuntimeException: Failed to push image. Error:Resource temporarily unavailable at Socket[addr=0.0.0.0/0.0.0.0,port=0,localport=0][fd=java.io.FileDescriptor@260c8928; file=/run/docker.sock; connected=true; bound=false]

at io.fabric8.kubernetes.workflow.PushImageStepExecution$1.call(PushImageStepExecution.java:78)

at io.fabric8.kubernetes.workflow.PushImageStepExecution$1.call(PushImageStepExecution.java:44)

at hudson.remoting.UserRequest.perform(UserRequest.java:121)

at hudson.remoting.UserRequest.perform(UserRequest.java:49)

at hudson.remoting.Request$2.run(Request.java:326)

at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)

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 hudson.remoting.Engine$1$1.run(Engine.java:69)

at java.lang.Thread.run(Thread.java:745)

at ......remote call to 7a8514c2305(Native Method)

at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416)

at hudson.remoting.UserResponse.retrieve(UserRequest.java:220)

at hudson.remoting.Channel.call(Channel.java:781)

at io.fabric8.kubernetes.workflow.PushImageStepExecution.run(PushImageStepExecution.java:44)

at io.fabric8.kubernetes.workflow.PushImageStepExecution.run(PushImageStepExecution.java:34)

at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:40)

at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:136)

at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:112)

at groovy.lang.GroovyObject$invokeMethod.call(Unknown Source)

at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)

at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)

at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:151)

at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:21)

at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:75)

at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:68)

at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:149)

at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146)

at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:15)

at io.fabric8.kubernetes.workflow.Kubernetes$PushImage.toRegistry(jar:file:/var/jenkins_home/plugins/kubernetes-workflow/WEB-INF/lib/kubernetes-workflow.jar!/io/fabric8/kubernetes/workflow/Kubernetes.groovy:297)

at io.fabric8.kubernetes.workflow.Kubernetes.node(jar:file:/var/jenkins_home/plugins/kubernetes-workflow/WEB-INF/lib/kubernetes-workflow.jar!/io/fabric8/kubernetes/workflow/Kubernetes.groovy:30)

at io.fabric8.kubernetes.workflow.Kubernetes$PushImage.toRegistry(jar:file:/var/jenkins_home/plugins/kubernetes-workflow/WEB-INF/lib/kubernetes-workflow.jar!/io/fabric8/kubernetes/workflow/Kubernetes.groovy:296)

at WorkflowScript.run(WorkflowScript:29)

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.GeneratedMethodAccessor118.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.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)

at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)

at sun.reflect.GeneratedMethodAccessor132.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.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:64)

at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)

at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:54)

at sun.reflect.GeneratedMethodAccessor134.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.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.SandboxContinuable.access$001(SandboxContinuable.java:19)

at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)

at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)

at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:106)

at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)

at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:164)

at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:274)

at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:74)

at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:183)

at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:181)

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)

Caused by: java.lang.RuntimeException: Failed to push image. Error:Resource temporarily unavailable at Socket[addr=0.0.0.0/0.0.0.0,port=0,localport=0][fd=java.io.FileDescriptor@260c8928; file=/run/docker.sock; connected=true; bound=false]

at io.fabric8.kubernetes.workflow.PushImageStepExecution$1$1.onError(PushImageStepExecution.java:63)

at io.fabric8.docker.client.impl.EventHandle.onFailure(EventHandle.java:104)

at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:185)

at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33)

... 3 more

Finished: FAILURE

@iocanel
Copy link
Member

iocanel commented Jan 29, 2016

@jmlambert78: Look at this line:

"Pushing image:null:null/fabric8io/nodejstest to docker registry."

Apparently the env vars that specify the registry host and port are not resolved properly.

Your script though seems correct, so I can only assume that the registry doesn't exists in the namespace you are using (AFAIR env vars for services are only propagated for the services that live in the current namespace).

@rawlingsj
Copy link
Contributor

I think this is fixed with this commit but I'm not able to test it at the moment. Sorry about the issues, yesterday was a bit or a rushed release at the end. I'll be able to look at the problem properly and test it over the weekend. https://github.com/rawlingsj/jenkins-workflow-library/commit/fa66fb7034cb3b029b31ec1e04a71e0f64fdf82d

@jmlambert78
Copy link
Author

I have updated the envvar of the default jenkinsfile to integrate the FABRIC8 docker registry instead of the generic registry.
def newVersion = getNewVersion{}
def clusterImageName = "${env.FABRIC8_DOCKER_REGISTRY_SERVICE_HOST}:${env.FABRIC8_DOCKER_REGISTRY_SERVICE_PORT}/${organisation}/${env.JOB_NAME}:${newVersion}"
def clusterImageNameWithoutTag = "${env.FABRIC8_DOCKER_REGISTRY_SERVICE_HOST}:${env.FABRIC8_DOCKER_REGISTRY_SERVICE_PORT}/${organisation}/${env.JOB_NAME}"
def dockerhubImageName = "docker.io/${organisation}/${env.JOB_NAME}:${newVersion}"

stage 'canary release'

if (!fileExists ('Dockerfile')) {
  writeFile file: 'Dockerfile', text: 'FROM node:5.3-onbuild'
}

kubernetes.image().withName(clusterImageName).build().fromPath(".")
kubernetes.image().withName(clusterImageNameWithoutTag).push().withTag(newVersion).toRegistry()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants