findFiles doesn't get dot directories

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      Looking at the code, this seems to be more of a general Jenkins issue than a plugin one, but I had to pick a place to file it, and this is where I'm seeing it.

      If I use dot (.) to represent the current directory, findFiles fails to find anything. Here's sample pipeline script and output.

      node {
          touch file: 'oneFile.txt'
          sh 'test -d dir/target || mkdir -p dir/target'
          touch file: 'dir/anotherFile.txt'
          touch file: 'dir/target/targetFile.txt'
          def period_star = findFiles glob: './*'
          def star = findFiles glob: '*'
          def period_doublestar = findFiles glob: './**'
          def doublestar = findFiles glob: '**'
          def dir_doublestar = findFiles glob: 'dir/**'
          def period_doublestar_target_doublestar = findFiles glob: './**/target/**'
          def doublestar_target_doublestar = findFiles glob: '**/target/**'
          echo "*: ${period_star.length} ${star.length}"
          echo "**: ${period_doublestar.length} ${doublestar.length} ${dir_doublestar.length}"
          echo "**/target/**: ${period_doublestar_target_doublestar.length} ${doublestar_target_doublestar.length}"
      }
      

      Output:

      [Pipeline] node
      Running on mesos-jenkins-260e7dcce7044a1b90d183a388efed99-mesos in /jenkins/workspace/findfiles_test_pipeline
      [Pipeline] {
      [Pipeline] touch
      [Pipeline] sh
      [findfiles_test_pipeline] Running shell script
      + test -d dir/target
      [Pipeline] touch
      [Pipeline] touch
      [Pipeline] findFiles
      [Pipeline] findFiles
      [Pipeline] findFiles
      [Pipeline] findFiles
      [Pipeline] findFiles
      [Pipeline] findFiles
      [Pipeline] findFiles
      [Pipeline] echo
      *: 0 2
      [Pipeline] echo
      **: 0 6 4
      [Pipeline] echo
      **/target/**: 0 2
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      

            Assignee:
            Rachel M.
            Reporter:
            Daniel Sobral
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: