• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • kubernetes-plugin
    • None
    • Jenkins 2.32.1
      pipeline 2.4
      kubernetes-plugin 0.10

      If pipeline has dir wrapper, i.e.

      podTemplate(...) {
        node('pod') {
          container('mycontainer') {
            dir('my/dir/path') {
              sh 'ls -l'
            }
          }
        }
      }
      

      shell step is still executed in the context of workspace root.
      Same pipeline works as expected (within directory path specified by dir step) outside of kubernetes pod.

          [JENKINS-40925] "dir" context is not honored by "sh" step

          Roman Safronov created issue -
          Roman Safronov made changes -
          Description Original: If pipeline has *dir* wrapper, i.e.
          {code}
          podTemplate(...) {
            node('pod') {
              container('mycontainer') {
                dir('my/dir/path') {
                  sh 'ls -l'
                }
              }
            }
          }
          {code}
          *shell* step is still executed in the context of workspace root.
          Same pipeline works as expected (within directory path specified by *dir* step)
          New: If pipeline has *dir* wrapper, i.e.
          {code}
          podTemplate(...) {
            node('pod') {
              container('mycontainer') {
                dir('my/dir/path') {
                  sh 'ls -l'
                }
              }
            }
          }
          {code}
          *shell* step is still executed in the context of workspace root.
          Same pipeline works as expected (within directory path specified by *dir* step) outside of kubernetes pod.
          Carlos Sanchez made changes -
          Link New: This issue is related to JENKINS-33510 [ JENKINS-33510 ]
          Carlos Sanchez made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]
          Carlos Sanchez made changes -
          Link New: This issue is duplicated by JENKINS-43188 [ JENKINS-43188 ]

            csanchez Carlos Sanchez
            electroma Roman Safronov
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: