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

"dir" context is not honored by "sh" step

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • kubernetes-plugin
    • None
    • Jenkins 2.32.1
      pipeline 2.4
      kubernetes-plugin 0.10

    Description

      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.

      Attachments

        Issue Links

          Activity

            electroma Roman Safronov created issue -
            electroma Roman Safronov made changes -
            Field Original Value New Value
            Description 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)
            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.
            csanchez Carlos Sanchez made changes -
            Link This issue is related to JENKINS-33510 [ JENKINS-33510 ]
            csanchez Carlos Sanchez made changes -
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]
            csanchez Carlos Sanchez made changes -
            Link This issue is duplicated by JENKINS-43188 [ JENKINS-43188 ]

            People

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

              Dates

                Created:
                Updated:
                Resolved: