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

Multibranch pipeline cannot find Jenkinsfile with Check out to a sub-directory

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major Major
    • pipeline
    • None
    • Jenkins ver. 2.19.2
      Pipeline 2.4
      Pipeline: Multibranch 2.9
      Ubuntu 16 LTS

      Problem Description

      Without Additional Behaviors > Check out to a sub-directory, Jenkins can find my Jenkinsfile.

      If I add Additional Behaviors > Check out to a sub-directory, Jenkins clones in the specified directory, but it still looks for Jenkinsfile at the top of the workspace.


      That's all for the bug report. I add the following for the sake of users who are experiencing the particular way that this problem manifests, and are searching for an explanation.

      Symptom

      When at first you do not use Additional Behaviors > Check out to a sub-directory a Jenkinsfile will be placed at the top of the workspace, and everything will work as expected.

      Then if you change your mind and start using Additional Behaviors > Check out to a sub-directory, Jenkins will forever use your old Jenkinsfile that remains at the top of the workspace--Jenkins will not see any updates to the Jenkinsfile that now appears in the sub-directory.

      Workaround

      First, do not use Additional Behaviors > Check out to a sub-directory in the Multibranch Pipeline Configuration.

      In Jenkinsfile, check out the main repository in the subdirectory using dir():

      dir('subDir') {
          checkout scm
      }

      See my StackOverflow answer for a discussion of checking out additional repositories.

            Unassigned Unassigned
            jmcgeheeiv John McGehee
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: