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

          Stephen Connolly created issue -
          Stephen Connolly made changes -
          Link New: This issue relates to JENKINS-32018 [ JENKINS-32018 ]
          Stephen Connolly made changes -
          Description Original: Use-case:

          The [Apache Maven Jenkinsfile|https://github.com/apache/maven/blob/e51fc87277bb988aed7641d02fd888c77d0a1206/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

          {code}
          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
                      ...
                  }
              }
          ...
          {code}

          There are a couple of important features:

          # 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
          # We want to allow a list of branches to be tried in preference order
          # 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
          New: Use-case:

          The [Apache Maven Jenkinsfile|https://github.com/apache/maven/blob/e51fc87277bb988aed7641d02fd888c77d0a1206/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

          {code}
          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
                      ...
                  }
              }
          ...
          {code}

          There are a couple of important features:

          # 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
          # We want to allow a list of branches to be tried in preference order
          # 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
          Stephen Connolly made changes -
          Remote Link New: This issue links to "PR#46 (Web Link)" [ 15223 ]
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Jesse Glick made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]
          Stephen Connolly made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Review [ 10005 ] New: Closed [ 6 ]
          CloudBees Inc. made changes -
          Remote Link New: This issue links to "CloudBees Internal OSS-1815 (Web Link)" [ 18554 ]

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

              Created:
              Updated:
              Resolved: