Jenkins Slave Failure

7/26/2018

I am running jenkins in kubernetes and tried to create a custom container to run the slaves with. I configured jenkins to pull my docker container and that seems to be working as expected (pulling it and starting it in K8s).

Unfortuanately I am getting an Access Denied Exception when running my pipeline. Not sure why I could be getting this error:

Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from 10.40.0.25/10.40.0.25:54108 at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1741) at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357) at hudson.remoting.Channel.call(Channel.java:955) at hudson.FilePath.act(FilePath.java:1036) at hudson.FilePath.act(FilePath.java:1025) at hudson.FilePath.mkdirs(FilePath.java:1208) at hudson.plugins.git.GitSCM.createClient(GitSCM.java:810) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1180) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:85) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:75) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47) at hudson.security.ACL.impersonate(ACL.java:290) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44) 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:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) java.nio.file.AccessDeniedException: /root/workspace at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) at sun.nio.fs.UnixFileSystemProvider.checkAccess(UnixFileSystemProvider.java:308) at java.nio.file.Files.createDirectories(Files.java:746) at hudson.FilePath.mkdirs(FilePath.java:3098) at hudson.FilePath.access$900(FilePath.java:209) at hudson.FilePath$Mkdirs.invoke(FilePath.java:1216) at hudson.FilePath$Mkdirs.invoke(FilePath.java:1212) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2913) at hudson.remoting.UserRequest.perform(UserRequest.java:212) at hudson.remoting.UserRequest.perform(UserRequest.java:54) at hudson.remoting.Request$2.run(Request.java:369) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:93) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE

DockerFile - the one that I used to create my slave container

FROM gcr.io/cloud-solutions-images/jenkins-k8s-slave
USER root
### INSTALL PRE REQUISITES
RUN apt-get update && apt-get install -y golang docker

Jenkinsfile - super simple pipeline

pipeline {
    agent any
    stages {
        stage('Download Code') {
            steps {
                echo 'Checking Out SCM..'
                checkout scm
            }
        }
        stage('Build container') {
            steps {
                sh 'docker build -t golangwebserver:minimal --build-arg KEY=$GITHUB_OATH_KEY -f DockerFiles/Dockerfile .'
            }
        }
    }
}

Any help would be much appreciated.

-- mornindew
docker
jenkins
jenkins-slave
kubernetes

0 Answers