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

Multibranch workflow projects

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: pipeline
    • Labels:
    • Similar Issues:

      Description

      The scm-api and branch-api plugins allow you to clearly organize a project by branches. Currently the Literate plugin and some others make use of them. It would be desirable for many flows to use this plugin so that builds from each branch of a repository are tracked independently.

      Cannot make flows enforce use of this in all cases (like Literate does), because general flows could check out from multiple repositories, do custom merge operations, and so onā€”things that cannot be statically represented as a set of branch subprojects. But for the common case where the flow is associated with a single repository, and it is going to do a standard CI clone/update step on a branch triggered by changes (like an AbstractProject with SCM enforces), it would be desirable to present a standard UI.

      The project configuration could specify the SCM sources and a label to check them out on, and the flow script would have to be run inside an implicit node block after checking out the branch. As a more flexible alternative, the current branch name could just be passed into the flow as a variable, which would then be responsible for doing the checkout itself. This is tricky because SCMSource.build(SCMHead, SCMRevision) is designed to return a live SCM, not metadata like branch names. Potentially the SCM itself (or its DescribableHelper.uninstantiate representation) could be passed as the variable, which you would pass with or without modification to the checkout step.

      As far as the existing APIs are concerned, a workflow could easily be an SCMSourceOwner. The main blocking issue is that MultiBranchProject and the like assume AbstractProject/AbstractBuild and so need to be refactored to allow Job/Run (perhaps with some further restrictions).

      SCMSource does not seem to support workspace-based polling, nor differentiating significant from insignificant changes (consider MercurialSCM.modules for example). However the literate plugin does not seem to use it directly for polling anyway; rather it creates the SCM and then uses that for polling.

        Attachments

          Issue Links

            Activity

            Hide
            jglick Jesse Glick added a comment -

            You would perhaps also want to be able to load the script from SCM (in the same branch), as in JENKINS-26101.

            Show
            jglick Jesse Glick added a comment - You would perhaps also want to be able to load the script from SCM (in the same branch), as in JENKINS-26101 .
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            pom.xml
            src/main/java/jenkins/branch/BranchProjectFactory.java
            src/main/java/jenkins/branch/BranchProperty.java
            src/main/java/jenkins/branch/BranchPropertyDescriptor.java
            src/main/java/jenkins/branch/BranchPropertyStrategyDescriptor.java
            src/main/java/jenkins/branch/BuildRetentionBranchProperty.java
            src/main/java/jenkins/branch/DeadBranchStrategy.java
            src/main/java/jenkins/branch/DeadBranchStrategyDescriptor.java
            src/main/java/jenkins/branch/DefaultDeadBranchStrategy.java
            src/main/java/jenkins/branch/DescriptorOrder.java
            src/main/java/jenkins/branch/IndexAtLeastTrigger.java
            src/main/java/jenkins/branch/JobDecorator.java
            src/main/java/jenkins/branch/MultiBranchProject.java
            src/main/java/jenkins/branch/MultiBranchProjectDescriptor.java
            src/main/java/jenkins/branch/ParameterDefinitionBranchProperty.java
            src/main/java/jenkins/branch/ProjectDecorator.java
            src/main/java/jenkins/branch/RateLimitBranchProperty.java
            src/main/java/jenkins/branch/UntrustedBranchProperty.java
            src/main/resources/jenkins/branch/MultiBranchProject/configure-common.jelly
            src/main/resources/jenkins/branch/ParameterDefinitionBranchProperty/config.jelly
            http://jenkins-ci.org/commit/branch-api-plugin/06f1e2f8f3a22fd94b80a7306f4bb79be014c4e2
            Log:
            Merge pull request #4 from jenkinsci/multibranch-workflow-JENKINS-26129

            JENKINS-26129 Prepare for multibranch workflows

            Compare: https://github.com/jenkinsci/branch-api-plugin/compare/83a7d3242992...06f1e2f8f3a2

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/jenkins/branch/BranchProjectFactory.java src/main/java/jenkins/branch/BranchProperty.java src/main/java/jenkins/branch/BranchPropertyDescriptor.java src/main/java/jenkins/branch/BranchPropertyStrategyDescriptor.java src/main/java/jenkins/branch/BuildRetentionBranchProperty.java src/main/java/jenkins/branch/DeadBranchStrategy.java src/main/java/jenkins/branch/DeadBranchStrategyDescriptor.java src/main/java/jenkins/branch/DefaultDeadBranchStrategy.java src/main/java/jenkins/branch/DescriptorOrder.java src/main/java/jenkins/branch/IndexAtLeastTrigger.java src/main/java/jenkins/branch/JobDecorator.java src/main/java/jenkins/branch/MultiBranchProject.java src/main/java/jenkins/branch/MultiBranchProjectDescriptor.java src/main/java/jenkins/branch/ParameterDefinitionBranchProperty.java src/main/java/jenkins/branch/ProjectDecorator.java src/main/java/jenkins/branch/RateLimitBranchProperty.java src/main/java/jenkins/branch/UntrustedBranchProperty.java src/main/resources/jenkins/branch/MultiBranchProject/configure-common.jelly src/main/resources/jenkins/branch/ParameterDefinitionBranchProperty/config.jelly http://jenkins-ci.org/commit/branch-api-plugin/06f1e2f8f3a22fd94b80a7306f4bb79be014c4e2 Log: Merge pull request #4 from jenkinsci/multibranch-workflow- JENKINS-26129 JENKINS-26129 Prepare for multibranch workflows Compare: https://github.com/jenkinsci/branch-api-plugin/compare/83a7d3242992...06f1e2f8f3a2
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            pom.xml
            src/main/java/org/cloudbees/literate/jenkins/BuildEnvironmentMapperDescriptor.java
            src/main/java/org/cloudbees/literate/jenkins/DefaultBuildEnvironmentMapper.java
            src/main/java/org/cloudbees/literate/jenkins/FilePathRepository.java
            src/main/java/org/cloudbees/literate/jenkins/LiterateBranchBuild.java
            src/main/java/org/cloudbees/literate/jenkins/LiterateBranchProject.java
            src/main/java/org/cloudbees/literate/jenkins/LiterateBranchProperty.java
            src/main/java/org/cloudbees/literate/jenkins/LiterateBuilder.java
            src/main/java/org/cloudbees/literate/jenkins/LiterateEnvironmentBuild.java
            src/main/java/org/cloudbees/literate/jenkins/LiterateEnvironmentProject.java
            src/main/java/org/cloudbees/literate/jenkins/LiterateMultibranchProject.java
            src/main/java/org/cloudbees/literate/jenkins/MigrateFreeStyleAction.java
            src/main/java/org/cloudbees/literate/jenkins/ParametersDefinitionBranchProperty.java
            src/main/java/org/cloudbees/literate/jenkins/ParentLiterateBranchBuildAction.java
            src/main/java/org/cloudbees/literate/jenkins/promotions/PromotionBranchProperty.java
            src/main/java/org/cloudbees/literate/jenkins/promotions/PromotionBuild.java
            src/main/java/org/cloudbees/literate/jenkins/promotions/PromotionProject.java
            src/main/java/org/cloudbees/literate/jenkins/promotions/PromotionTargetAction.java
            src/main/java/org/cloudbees/literate/jenkins/promotions/PromotionTrigger.java
            src/main/java/org/cloudbees/literate/jenkins/publishers/Agent.java
            src/main/java/org/cloudbees/literate/jenkins/publishers/ArtifactsAgent.java
            src/main/java/org/cloudbees/literate/jenkins/publishers/DefaultXmlAgent.java
            src/main/java/org/cloudbees/literate/jenkins/publishers/JUnitReportAgent.java
            src/main/resources/org/cloudbees/literate/jenkins/ParametersDefinitionBranchProperty/config.jelly
            src/test/java/org/cloudbees/literate/jenkins/ParametersDefinitionBranchPropertyTest.java
            http://jenkins-ci.org/commit/literate-plugin/eeeab34f131ebfd5aac1622dbd36948975839bc6
            Log:
            Merge pull request #6 from jenkinsci/multibranch-workflow-JENKINS-26129

            JENKINS-26129 Adapting to upstream changes

            Compare: https://github.com/jenkinsci/literate-plugin/compare/1f7e685d055d...eeeab34f131e

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/org/cloudbees/literate/jenkins/BuildEnvironmentMapperDescriptor.java src/main/java/org/cloudbees/literate/jenkins/DefaultBuildEnvironmentMapper.java src/main/java/org/cloudbees/literate/jenkins/FilePathRepository.java src/main/java/org/cloudbees/literate/jenkins/LiterateBranchBuild.java src/main/java/org/cloudbees/literate/jenkins/LiterateBranchProject.java src/main/java/org/cloudbees/literate/jenkins/LiterateBranchProperty.java src/main/java/org/cloudbees/literate/jenkins/LiterateBuilder.java src/main/java/org/cloudbees/literate/jenkins/LiterateEnvironmentBuild.java src/main/java/org/cloudbees/literate/jenkins/LiterateEnvironmentProject.java src/main/java/org/cloudbees/literate/jenkins/LiterateMultibranchProject.java src/main/java/org/cloudbees/literate/jenkins/MigrateFreeStyleAction.java src/main/java/org/cloudbees/literate/jenkins/ParametersDefinitionBranchProperty.java src/main/java/org/cloudbees/literate/jenkins/ParentLiterateBranchBuildAction.java src/main/java/org/cloudbees/literate/jenkins/promotions/PromotionBranchProperty.java src/main/java/org/cloudbees/literate/jenkins/promotions/PromotionBuild.java src/main/java/org/cloudbees/literate/jenkins/promotions/PromotionProject.java src/main/java/org/cloudbees/literate/jenkins/promotions/PromotionTargetAction.java src/main/java/org/cloudbees/literate/jenkins/promotions/PromotionTrigger.java src/main/java/org/cloudbees/literate/jenkins/publishers/Agent.java src/main/java/org/cloudbees/literate/jenkins/publishers/ArtifactsAgent.java src/main/java/org/cloudbees/literate/jenkins/publishers/DefaultXmlAgent.java src/main/java/org/cloudbees/literate/jenkins/publishers/JUnitReportAgent.java src/main/resources/org/cloudbees/literate/jenkins/ParametersDefinitionBranchProperty/config.jelly src/test/java/org/cloudbees/literate/jenkins/ParametersDefinitionBranchPropertyTest.java http://jenkins-ci.org/commit/literate-plugin/eeeab34f131ebfd5aac1622dbd36948975839bc6 Log: Merge pull request #6 from jenkinsci/multibranch-workflow- JENKINS-26129 JENKINS-26129 Adapting to upstream changes Compare: https://github.com/jenkinsci/literate-plugin/compare/1f7e685d055d...eeeab34f131e
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            CHANGES.md
            http://jenkins-ci.org/commit/workflow-plugin/f9e737689bd22e81e1c66892031e997100a80696
            Log:
            JENKINS-26129 Noting.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: CHANGES.md http://jenkins-ci.org/commit/workflow-plugin/f9e737689bd22e81e1c66892031e997100a80696 Log: JENKINS-26129 Noting.

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                jglick Jesse Glick
              • Votes:
                4 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: