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

Docker Pipeline plugin: dir property in the DSL agent dockerfile does not work when Jenkins master is Windows machine(backslash problem)

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Labels:
      None
    • Environment:
      Jenkins Master(Windows Server 2012), version 2.92
      docker-workflow-plugin 1.14
      Jenkins Slave(Debian 8), docker 17.09.0-ce
    • Similar Issues:
    • Sprint:
      Pipeline - December

      Description

      I've tried to use docker agent via dockerfile property. But it seems it does not work when I use dir property like this:

      ```
      agent {
      dockerfile {
      dir "Docker/debian-6"
      label "docker"
      }
      }
      ```

      Caveat is that Jenkins Master machine is Windows Server 2012. I've took a look at pipeline.log artifact and see that docker-workflow-plugin use path with backslash.

      It's part of this pipeline.log:

      ```

      [Pipeline] withEnv

      [Pipeline] {

      [Pipeline] stage

      [Pipeline] { (Declarative: Agent Setup)

      [Pipeline] readFile

      [Pipeline] sh [ORG_SUBMODULE_TEST_1.0-RGUTA527APORVGDNZVI75RGUDPT4CP6FYZ65GVGMMHAULYZFWKMQ] Running shell script + docker build -t 3d071d6ed0f35961fba3596ce9e2d38536e0657a -f Docker/debian-6\Dockerfile Docker/debian-6 unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /home/user/jenkins/workspace/ORG_SUBMODULE_TEST_1.0-RGUTA527APORVGDNZVI75RGUDPT4CP6FYZ65GVGMMHAULYZFWKMQ/Docker/debian-6\Dockerfile: no such file or directory

      [Pipeline] }

      [Pipeline] // stage

      [Pipeline] }

      [Pipeline] // withEnv

      [Pipeline] }

      ```

        Attachments

          Issue Links

            Activity

            Hide
            abayer Andrew Bayer added a comment -

            Dang it, another quote escaping issue I missed. I’ll get a PR up tomorrow - sorry for the hassle.

            Show
            abayer Andrew Bayer added a comment - Dang it, another quote escaping issue I missed. I’ll get a PR up tomorrow - sorry for the hassle.
            Hide
            olecsys Aleksandr Gamoskin added a comment -

            Andrew let me know about fix here. I could test it on my system. And thank you for quick reply.

            Show
            olecsys Aleksandr Gamoskin added a comment - Andrew let me know about fix here. I could test it on my system. And thank you for quick reply.
            Hide
            abayer Andrew Bayer added a comment -

            Got a PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/226 - but I can't easily unit test it, since the issue is a mismatch between master and agent directory separators. Fun!

            Show
            abayer Andrew Bayer added a comment - Got a PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/226  - but I can't easily unit test it, since the issue is a mismatch between master and agent directory separators. Fun!
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfile.java
            pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/73f434e464361303b7d7020bebe72e3f9ac646c0
            Log:
            [FIXED JENKINS-48229] Use the agent's dir separator for Dockerfile path

            I'm not sure how to test this - the issue occurs when the master's
            got different directory separators than the agent, which isn't
            something I can easily do in a unit test.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfile.java pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy http://jenkins-ci.org/commit/pipeline-model-definition-plugin/73f434e464361303b7d7020bebe72e3f9ac646c0 Log: [FIXED JENKINS-48229] Use the agent's dir separator for Dockerfile path I'm not sure how to test this - the issue occurs when the master's got different directory separators than the agent, which isn't something I can easily do in a unit test.
            Hide
            bitwiseman Liam Newman added a comment -

            Bulk closing resolved issues.

            Show
            bitwiseman Liam Newman added a comment - Bulk closing resolved issues.

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                olecsys Aleksandr Gamoskin
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: