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

Warn if "Additional Behaviors > Check out to a sub-directory" is used in a Pipeline project

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • git-plugin
    • Jenkins ver. 2.19.2
      Pipeline 2.4
      Pipeline: Multibranch 2.9
      Ubuntu 16 LTS

      Additional Behaviors > Check out to a sub-directory clones Jenkinsfile in the specified directory. Meanwhile, Jenkins itself continues to look for Jenkinsfile at the top of the workspace.  This is very confusing.

      As far as I can see, Additional Behaviors > Check out to a sub-directory is never appropriate with Pipeline.  This should be handled in Jenkinsfile using dir():

      dir('subDir') {
          checkout scm
      }

      In JENKINS-40267, jglick suggested that git-plugin should conditionally display the Additional Behaviors > Check out to a sub-directory option only if the AncestorInPath is an AbstractProject.

      Removing the option might break compatibility but we could print an explanatory warning into the build log. The warning would say that Check out to a sub-directory is not intended for use with Pipeline jobs. The message should describe the preferred declarative technique of using the the dir step to provide a subdirectory which contains the checkout or using the checkoutToSubdirectory option.

            Unassigned Unassigned
            jmcgeheeiv John McGehee
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: