-
Notifications
You must be signed in to change notification settings - Fork 148
[JENKINS-76325] Organization Folder: Support creating multiple projects from a single repository based on multiple Jenkinsfile paths #572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
what would happen if I had a repository called Currently if users setup multiple orgainzation folders for each of their marker files they can use https://plugins.jenkins.io/github-scm-trait-notification-context/ to set a specific trait on the root folder, but if this is all configured in one folder how would a user be able to differntiate? (I would guess similar issues exists for Gerrit and other branch sources that report back using a "well known" id) |
|
Cannot speak for @jtnord but I am not inclined to accept any significant enhancements to the multibranch-related plugins at this point, only safe-looking fixes for clear bugs. See the (lengthy) discussions in linked Jira issues. The broader issue is that multibranch was deliberately designed to be quite opinionated, in a way that works well for common cases but is impractical to extend to more complex and idiosyncratic repository structures (especially monorepos). Something along the lines of jenkinsci/job-dsl-plugin#2072 could offer a far more extensible system, for those users willing to accept trickier setup, without requiring plugin code changes and thus making Jenkins developers the bottleneck. |
|
@jtnord Thank you for your feedback. Here are some additional clarifications:
The outcome depends on the order in which repositories are returned by the SCM source. The repository scanned last will take precedence. During testing on a Gitea server, I observed that repositories created later are scanned later. For example, if Although this behavior is not ideal, it is at least predictable. Repository maintainers should be aware of this dynamic when enabling the feature, and can avoid potential conflicts by carefully choosing repository names, Jenkinsfile names, and regex patterns accordingly.
This is a known issue that can occur whenever multiple Jenkins projects share the same SCM resource, regardless of how they are created. The feature described should not be enabled if this conflict is a concern for your use case.
I haven't personally used this plugin, but based on its description, the configuration appears to be applied at the SCM level. The feature I described only modifies the Jenkins project (display) name and folder structure. Since it doesn't alter the underlying SCM configuration or how Jenkins identifies repositories, it likely wouldn't affect the GitHub notification context behavior you're referring to. Let me know if you need further details on any specific aspect. |
|
@jglick Thank you for your feedback as well. This plugin has been incredibly helpful for setting up a dozen Jenkins pipelines for our large product with multiple repositories. Unfortunately, Jenkinsfile and DSL configurations only take effect after a Jenkins project has already been created. The specific challenge we encountered occurs during the initial project creation phase, which is where this plugin provides the solution we needed. |
Depending on the server, ordering from servers can be unstable (a list of repositories is a list, which may or may not be in any order and whose order may or may not remain stable over time), or depend on the time the query was created. When coupled with creating the org folder as code and DR restoring from this backup you may well have inconsistent and or unpredictable results.
Repository maintainers may not even be aware. Organisation folders can filter repositories by access so it would not be a problem today but tomorrow you could have a re-org and introduce a large amount of conflicts. So today I maybe not able to even see the existence of the
This is a solved problem today, for example you apply the trait mentioned above in the case of GitHub.
The option is defined in the MBP and or Organsisation folder Item. As such with this solution you can not apply it so that different jobs from the same repo but different Jenkinsfile get different checks. -- There are also other project recognizers, not all recognizers use a file in the SCM). e.g. https://github.com/jenkinsci/remote-file-plugin/blob/9c0cac6de2053acb1af25916f9dd25febe8694de/src/main/java/org/jenkinsci/plugins/workflow/multibranch/extended/RemoteJenkinsFileWorkflowMultiBranchProjectFactory.java#L24 / https://github.com/jenkinsci/inline-pipeline-plugin/ causing the reflection used here to break and this recognizer to not be available. Due to these issues that I know about (and I am sure there will be several that I do not know about) , its does not appear that this will integrate well into in the wider ecosystem, causing enhanced maintenance effort. This is somewhat echoed (more strongly) by Jesse's comment. At this current moment in time I am inclined to agree with Jesse that this is not something I am willing to accept at this time. |
Description:
This PR implements the feature requested in JENKINS-76325, enabling Organization Folders to create multiple projects from a single repository when multiple Jenkinsfiles are detected.
Changes:
UI Enhancement: Added configuration options to the Organization Folder:
Checkbox to enable/disable multi-project mode
Regex pattern field to extract project name suffix from Jenkinsfile paths
Core Logic: Modified project recognition to create separate projects for each valid Jenkinsfile found, rather than stopping at the first match.
Testing done
Submitter checklist