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

Image.inside overrides working directory

    XMLWordPrintable

Details

    Description

      Image.inside automatically sets up volumes and a workdir. Its impossible to override this workdir. Ideally workdir should not be touched at all IMO but at the very least it should be overridable.

      When using a command like this:

      build.inside('-w /usr/src/app/') {
        sh 'npm run lint'
      }
      

      You'll get output like this

      [Pipeline] withDockerContainer
      $ docker run -t -d -u 1002:1002 -w /usr/src/app/ -w /home/*******/workspace/*******/development -v /home/*******/workspace/*******/development:/home/*******/workspace/*******/development:rw -v /home/*******/workspace/*******/development@tmp:/home/*******/workspace/*******/development@tmp:rw -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** *******:5000/*******/*******:11-feature
      

      You can see that the `-w` option is passed to the command but since the plugin forces `-w` /path/to/jenkins/workspace no matter what their is no way around this outside `cd /workdir` inside every inside command.

      Attachments

        Issue Links

          Activity

            People

              jglick Jesse Glick
              nitropye Coleman
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: