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

customWorkspace does not work with docker agent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • jenkins:2.60.3
      pipeline-model-definition:1.2.5

      Stages execute using docker with customWorkspace use the correct directory.
      Example pipeline:

      pipeline {
        agent {
          label 'docker_host'
        }
        stages {
          stage('create file') {
            steps {
              dir('subdir') {
                sh 'touch newFileInSubDir'
              }
            }
          }
          stage('Test file exists in subdir') {
            agent {
              docker {
                image 'debian:stable-slim'
                reuseNode true
                customWorkspace 'subdir'
              }
            }
            steps {
              sh "ls -laR"
              sh "test -f newFileInSubDir"
            }
          }
        }
        post {
          always {
            deleteDir()
          }
        }
      }
      

      This fails on the last test. I would expect it to succeed or if customWorkspace is not supported, then the script validation should fail.

            Unassigned Unassigned
            fkykko Staffan Forsell
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: