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

Resolve an SCM from an SCMSource and a list of candidate target branch names

      Use-case:

      The Apache Maven Jenkinsfile wants to run integration tests when testing a build of Maven core.

      As new features are added, there is often a need to add associated integration tests.

      It would be great if the Jenkinsfile could easily determine if there is a matching branch in the maven-integration-testing repository and check that out... but if there is no matching branch then the master branch should be used instead.

      Something like

      def tests=resolveScm(source:git(url:'https://git-wip-us.apache.org/repos/asf/maven-integration-testing.git'), targets:[env.BRANCH_NAME,'master']))
      node('ubuntu') {
          stage 'Checkout'{
              ...
              checkout scm
          }
         ...
      }
      
      stage 'Integration Test'
      parallel linuxJava7:{
              node('ubuntu') {
                  checkout tests
                  ...
              }
          },linuxJava8: {
              node('ubuntu') {
                  checkout tests
                  ...
              }
          },winJava7: {
              node('windows-2012') {
                  checkout tests
                  ...
              }
          },winJava8: {
              node('windows-2012') {
                  checkout tests
                  ...
              }
          }
      ...
      

      There are a couple of important features:

      1. We want to use the SCMSource to create the SCM so that it has a pinned revision and the same version of the tests are used on each of the parallel integration test runs
      2. We want to allow a list of branches to be tried in preference order
      3. We want to avoid requiring conditional behaviour to use this feature in the pipeline so that it can also be used from pipeline-model-definition based pipelines

          [JENKINS-40906] Resolve an SCM from an SCMSource and a list of candidate target branch names

          Some similarities and partial overlap in use-cases

          Stephen Connolly added a comment - Some similarities and partial overlap in use-cases

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep.java
          src/test/java/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStepTest.java
          http://jenkins-ci.org/commit/workflow-multibranch-plugin/ac4f279c4f5765e3d704c8c224fe2540f4cf5c51
          Log:
          [FIXED JENKINS-40906] Resolve an SCM from an SCMSource and a list of candidate target branch names

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep.java src/test/java/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStepTest.java http://jenkins-ci.org/commit/workflow-multibranch-plugin/ac4f279c4f5765e3d704c8c224fe2540f4cf5c51 Log: [FIXED JENKINS-40906] Resolve an SCM from an SCMSource and a list of candidate target branch names

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/java/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep.java
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/config.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/help-ignoreErrors.html
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/help-source.html
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/help-targets.html
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/help.html
          http://jenkins-ci.org/commit/workflow-multibranch-plugin/c818d7dec11e20904a1ffd42631aaf2cd1c2218a
          Log:
          JENKINS-40906 The missing configuration UI

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep.java src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/config.jelly src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/help-ignoreErrors.html src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/help-source.html src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/help-targets.html src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/help.html http://jenkins-ci.org/commit/workflow-multibranch-plugin/c818d7dec11e20904a1ffd42631aaf2cd1c2218a Log: JENKINS-40906 The missing configuration UI

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep.java
          http://jenkins-ci.org/commit/workflow-multibranch-plugin/76f9cfa355b0840678433ddd8fb0a282040959a8
          Log:
          JENKINS-40906 I think this addresses the remaining code review comments

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep.java http://jenkins-ci.org/commit/workflow-multibranch-plugin/76f9cfa355b0840678433ddd8fb0a282040959a8 Log: JENKINS-40906 I think this addresses the remaining code review comments

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep.java
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/help.html
          http://jenkins-ci.org/commit/workflow-multibranch-plugin/cf5969d3143ae4489c49c7a2d5deff4ad27347be
          Log:
          JENKINS-40906 Address code review comments

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep.java src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/help.html http://jenkins-ci.org/commit/workflow-multibranch-plugin/cf5969d3143ae4489c49c7a2d5deff4ad27347be Log: JENKINS-40906 Address code review comments

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep.java
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/config.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/help-ignoreErrors.html
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/help-source.html
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/help-targets.html
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/help.html
          http://jenkins-ci.org/commit/workflow-multibranch-plugin/b59ddd21827fcb9467df876bbaea5f799900a26c
          Log:
          Merge pull request #50 from stephenc/jenkins-40906

          JENKINS-40906 The missing configuration UI

          Compare: https://github.com/jenkinsci/workflow-multibranch-plugin/compare/068add403912...b59ddd21827f

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep.java src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/config.jelly src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/help-ignoreErrors.html src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/help-source.html src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/help-targets.html src/main/resources/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep/help.html http://jenkins-ci.org/commit/workflow-multibranch-plugin/b59ddd21827fcb9467df876bbaea5f799900a26c Log: Merge pull request #50 from stephenc/jenkins-40906 JENKINS-40906 The missing configuration UI Compare: https://github.com/jenkinsci/workflow-multibranch-plugin/compare/068add403912...b59ddd21827f

            stephenconnolly Stephen Connolly
            stephenconnolly Stephen Connolly
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: