Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-43188

kubernetes-plugin: cd command in shell-skript

XMLWordPrintable

      Hello developers,

      we use the slave-concept with the kubernetes-plugin and have the problem, that if we have a shell-execution in our jenkinsfile

      stage("Build package") {
        sh "mvn -B -e -DskipTests=true package"
      }
      

      following output will be generated:

      14:28:09 [slave-test-maven] Running shell script
      14:28:10 Executing shell script inside container [maven] of pod [kubernetes-0dc050be67154d298f102ee26ddd426a-98614902c33e1]
      14:28:10 Executing command: sh -c echo $$ > '/home/jenkins/workspace/slave-test-maven@tmp/durable-0c724a72/pid'; jsc=durable-8ba4134c5915e9a1902ba50cb9868750; JENKINS_SERVER_COOKIE=$jsc '/home/jenkins/workspace/slave-test-maven@tmp/durable-0c724a72/script.sh' > '/home/jenkins/workspace/slave-test-maven@tmp/durable-0c724a72/jenkins-log.txt' 2>&1; echo $? > '/home/jenkins/workspace/slave-test-maven@tmp/durable-0c724a72/jenkins-result.txt' 
      14:28:10 cd "/home/jenkins/workspace/slave-test-maven"
      14:28:10 sh -c echo $$ > '/home/jenkins/workspace/slave-test-maven@tmp/durable-0c724a72/pid'; jsc=durable-8ba4134c5915e9a1902ba50cb9868750; JENKINS_SERVER_COOKIE=$jsc '/home/jenkins/workspace/slave-test-maven@tmp/durable-0c724a72/script.sh' > '/home/jenkins/workspace/slave-test-maven@tmp/durable-0c724a72/jenkins-log.txt' 2>&1; echo $? > '/home/jenkins/workspace/slave-test-maven@tmp/durable-0c724a72/jenkins-result.txt' 
      14:28:10 exit
      14:28:10 [?1034hsh-4.2$ cd "/home/jenkins/workspace/slave-test-maven"
      14:28:10 sh-4.2$ sh -c echo $$ > '/home/jenkins/workspace/slave-test-maven@tmp/durable-0c 
      724a72/pid'; jsc=durable-8ba4134c5915e9a1902ba50cb9868750; JENKINS_SERVER_COOKIE 
      =$jsc '/home/jenkins/workspace/slave-test-maven@tmp/durable-0c724a72/script.sh'  
      > '/home/jenkins/workspace/slave-test-maven@tmp/durable-0c724a72/jenkins-log.txt 
      ' 2>&1; echo $? > '/home/jenkins/workspace/slave-test-maven@tmp/durable-0c724a72 
      /jenkins-result.txt
      

      The

      cd "/home/jenkins/workspace/slave-test-maven"
      

      makes a

      dir('') {
          // some block
      }
      

      not working.

      Perhaps we are using the plugin in a wrong way.

      Thank you for your support.

            csanchez Carlos Sanchez
            georgestark Sascha Vujevic
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: