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

Docker build on linux slave fails due to '\' backslash

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      The plugin is failing while running on a linux slave node. I have the "Build Context" set to "helloworld/build". It appears somewhere alone the line that is being translated into "helloworld\build" which is causing issues on the linux agent. See log below.

      Plugin version 1.2.2 (latest)
      Docker version 1.8.2-el7, build a01dc02/1.8.2
      Note that I have a node in a different environment running docker 1.9.1 and I don't encounter this issue.

      docker build -t registry/repository/helloworld:v1.0.0 --no-cache=true --pull=true helloworld\build
      unable to prepare context: unable to evaluate symlinks in context path: lstat /var/appl/jenkins/workspace/workspace/helloworld\build: no such file or directory
      Build step 'Docker Build and Publish' marked build as failure
      [BFA] Scanning build for known causes...
      

        Attachments

          Activity

          Hide
          mrichar2 Mark R added a comment - - edited

          Possibly due to this line (DockerBuilder.java):

          FilePath context = defined(expandAll(getBuildContext())) ? new FilePath(new File(expandAll(getBuildContext())))
                              : build.getWorkspace();
          

          Master is windows host so File is created with windows slash style.

          Could do something similar to what getWorkspace() does in AbstractBuilder by accessing the getBuiltOn() node if it is not null and creating a path from there.

          Show
          mrichar2 Mark R added a comment - - edited Possibly due to this line (DockerBuilder.java): FilePath context = defined(expandAll(getBuildContext())) ? new FilePath( new File(expandAll(getBuildContext()))) : build.getWorkspace(); Master is windows host so File is created with windows slash style. Could do something similar to what getWorkspace() does in AbstractBuilder by accessing the getBuiltOn() node if it is not null and creating a path from there.
          Show
          mrichar2 Mark R added a comment - Pull request @ https://github.com/jenkinsci/docker-build-publish-plugin/pull/42
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Mark
          Path:
          src/main/java/com/cloudbees/dockerpublish/DockerBuilder.java
          http://jenkins-ci.org/commit/docker-build-publish-plugin/46d450db5a3e057f26f580a4a311764ea1efcff4
          Log:
          JENKINS-35000 Incorrect file backslash when slave is linux (#42)

          Incorrect file backslash when slave is linux and master is windows

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Path: src/main/java/com/cloudbees/dockerpublish/DockerBuilder.java http://jenkins-ci.org/commit/docker-build-publish-plugin/46d450db5a3e057f26f580a4a311764ea1efcff4 Log: JENKINS-35000 Incorrect file backslash when slave is linux (#42) Incorrect file backslash when slave is linux and master is windows
          Hide
          csanchez Carlos Sanchez added a comment -

          Merged, thanks

          Show
          csanchez Carlos Sanchez added a comment - Merged, thanks

            People

            Assignee:
            csanchez Carlos Sanchez
            Reporter:
            mrichar2 Mark R
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: