customWorkspace does not work with docker agent

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      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.

            Assignee:
            Unassigned
            Reporter:
            Staffan Forsell
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: