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

customWorkspace does not work with docker agent

    • 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.

          [JENKINS-48319] customWorkspace does not work with docker agent

          Staffan Forsell created issue -

          Andrew Bayer added a comment -

          This doesn't surprise me, sadly - Docker Pipeline (which is what's used behind the scenes for Declarative's Docker agent) doesn't work with custom workspaces.

          Andrew Bayer added a comment - This doesn't surprise me, sadly - Docker Pipeline (which is what's used behind the scenes for Declarative's Docker agent) doesn't work with custom workspaces.

          So it's supposed to work? Or should the docs and validation be updated?

          I'm guessing it's not just as simple as changing the volume mount point for the docker container?

          Staffan Forsell added a comment - So it's supposed to work? Or should the docs and validation be updated? I'm guessing it's not just as simple as changing the volume mount point for the docker container?
          Andrew Bayer made changes -
          Link New: This issue is duplicated by JENKINS-53711 [ JENKINS-53711 ]
          Andrew Bayer made changes -
          Assignee Original: Andrew Bayer [ abayer ]

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

              Created:
              Updated: