In multibranch pipeline and Github organization folder the name Jenkinsfile is hard-coded and always looks for the top level folder.

      It would be useful to have the option to search other specified files (even located in subfolders) to face cases like:

      • having multiple repo-scanners managed by one project that create different pipelines from the same repo (they do different things, executing on different schedules)
      • some git repos requires a project layout that forbids all root-level files with some exceptions

          [JENKINS-34561] Allow to detect different Jenkinsfile filenames

          Martin Sander added a comment -

          As jglick had issues with danielbutler's pull request, I tried to address his concerns:

          https://github.com/jenkinsci/workflow-multibranch-plugin/pull/59

          Martin Sander added a comment - As jglick had issues with danielbutler 's pull request, I tried to address his concerns: https://github.com/jenkinsci/workflow-multibranch-plugin/pull/59

          Code changed in jenkins
          User: Martin Sander
          Path:
          src/main/java/org/jenkinsci/plugins/workflow/multibranch/SCMBinder.java
          src/main/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory.java
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory/config.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory/help-scriptPath.html
          http://jenkins-ci.org/commit/workflow-multibranch-plugin/8bf42aa50df59fb4f757cedd22231877057bd614
          Log:
          Make Jenkinsfile filename configurable, JENKINS-34561

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Martin Sander Path: src/main/java/org/jenkinsci/plugins/workflow/multibranch/SCMBinder.java src/main/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory.java src/main/resources/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory/config.jelly src/main/resources/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory/help-scriptPath.html http://jenkins-ci.org/commit/workflow-multibranch-plugin/8bf42aa50df59fb4f757cedd22231877057bd614 Log: Make Jenkinsfile filename configurable, JENKINS-34561

          Code changed in jenkins
          User: Daniel Butler
          Path:
          src/main/java/org/jenkinsci/plugins/workflow/multibranch/SCMBinder.java
          src/main/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory.java
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory/config.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory/getting-started.jelly
          src/test/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectTest.java
          http://jenkins-ci.org/commit/workflow-multibranch-plugin/c9f6cbef5917dd40716a33511145787324d741c2
          Log:
          Add test for JENKINS-34561

          plus:

          • minor text fixes
          • remove unnecessary code in SCMBinder.DescriptorImpl

          All code copied from @dbut023's branch.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Butler Path: src/main/java/org/jenkinsci/plugins/workflow/multibranch/SCMBinder.java src/main/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory.java src/main/resources/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory/config.jelly src/main/resources/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory/getting-started.jelly src/test/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectTest.java http://jenkins-ci.org/commit/workflow-multibranch-plugin/c9f6cbef5917dd40716a33511145787324d741c2 Log: Add test for JENKINS-34561 plus: minor text fixes remove unnecessary code in SCMBinder.DescriptorImpl All code copied from @dbut023's branch.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/org/jenkinsci/plugins/workflow/multibranch/SCMBinder.java
          src/main/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory.java
          src/main/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectFactory.java
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory/config.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory/getting-started.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory/help-scriptPath.html
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectFactory/config.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectFactory/help-scriptPath.html
          src/test/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectFactoryTest.java
          src/test/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectTest.java
          http://jenkins-ci.org/commit/workflow-multibranch-plugin/a380959e8190155431b16b3ddc945a85514155f7
          Log:
          Merge pull request #59 from marvinthepa/JENKINS-34561-configurable-filename-for-Jenkinsfile

          JENKINS-34561 Make Jenkinsfile filename configurable

          Compare: https://github.com/jenkinsci/workflow-multibranch-plugin/compare/57b8f2ca2103...a380959e8190

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/workflow/multibranch/SCMBinder.java src/main/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory.java src/main/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectFactory.java src/main/resources/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory/config.jelly src/main/resources/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory/getting-started.jelly src/main/resources/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory/help-scriptPath.html src/main/resources/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectFactory/config.jelly src/main/resources/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectFactory/help-scriptPath.html src/test/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectFactoryTest.java src/test/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectTest.java http://jenkins-ci.org/commit/workflow-multibranch-plugin/a380959e8190155431b16b3ddc945a85514155f7 Log: Merge pull request #59 from marvinthepa/ JENKINS-34561 -configurable-filename-for-Jenkinsfile JENKINS-34561 Make Jenkinsfile filename configurable Compare: https://github.com/jenkinsci/workflow-multibranch-plugin/compare/57b8f2ca2103...a380959e8190

          David Aldrich added a comment -

          Thanks for making this change. Is there any user documentation for it?

          David Aldrich added a comment - Thanks for making this change. Is there any user documentation for it?

          Jesse Glick added a comment -

          There is inline help.

          Jesse Glick added a comment - There is inline help.

          I've just updated to 2.17 version and my Jenkins builds stopped working. I see that Jenkins files are not found anymore
          "test/Jenkinsfile’ not found"
          I have my Jenkins file in a subdirectory on each branch

          • test/Jenkinsfile

          And it seems that subdirectories are not checked properly in 2.17 version.

          If I move my Jenkinsfile to the root/HEAD of the branch then it is found and plugin works.

          Is this something that got changed in 2.17 version ?

          Audrius Idzelis added a comment - I've just updated to 2.17 version and my Jenkins builds stopped working. I see that Jenkins files are not found anymore "test/Jenkinsfile’ not found" I have my Jenkins file in a subdirectory on each branch test/Jenkinsfile And it seems that subdirectories are not checked properly in 2.17 version. If I move my Jenkinsfile to the root/HEAD of the branch then it is found and plugin works. Is this something that got changed in 2.17 version ?

          Damien Merlin added a comment - - edited

          Hi Audrius, I think I got the same issue as you reported. But you misidentified the plugin. Check https://issues.jenkins-ci.org/browse/JENKINS-49261

          Damien Merlin added a comment - - edited Hi Audrius, I think I got the same issue as you reported. But you misidentified the plugin. Check https://issues.jenkins-ci.org/browse/JENKINS-49261

          Hi merlindam - you're right. Thank you for the update.

          Audrius Idzelis added a comment - Hi merlindam - you're right. Thank you for the update.

          xiongfang nie added a comment - - edited

          Hi there,

          I'm using this great feature, one problem I was seeking for help is that how can I get the jenkinsfile script name inside the jenkinsfile:

          say the project was cconfigured as 'jenkins/Jenkinsfile.k8s.test', is there a way to get the 'jenkins/Jenkinsfile.k8s.test' within script Jenkinsfile.k8s.test?

          I tried this.class.getName(), which simply returned: 'WorkflowScript'

          Basically, I'd like to use some naming convention on the jenkinsfile to save some configurations.

           

          thanks in advance!

           

          xiongfang nie added a comment - - edited Hi there, I'm using this great feature, one problem I was seeking for help is that how can I get the jenkinsfile script name inside the jenkinsfile: say the project was cconfigured as 'jenkins/Jenkinsfile.k8s.test', is there a way to get the 'jenkins/Jenkinsfile.k8s.test' within script Jenkinsfile.k8s.test? I tried this.class.getName(), which simply returned: 'WorkflowScript' Basically, I'd like to use some naming convention on the jenkinsfile to save some configurations.   thanks in advance!  

            0x89 Martin Sander
            dariver Darío Villadiego
            Votes:
            42 Vote for this issue
            Watchers:
            54 Start watching this issue

              Created:
              Updated:
              Resolved: