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

Pull request with a conflict and SCM poll properties runs in an infinite loop

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: pipeline
    • Labels:
      None
    • Similar Issues:

      Description

      It appears that a Multibranch Pipeline, with a Pull Request with a conflict in the source code (related to JENKINS-48581), will result in an infinite loop errors because of the conflict.

      Best I can tell is that because this Pipeline is using an SCM Poll, whenever it polls in the Pull Request, it sees an exception and fails to complete the polling operation, which results in the Pipeline executing and failing every 15 minutes.

      #!/usr/bin/env groovy
      
      def imageName = 'jenkinsciinfra/account-app'
      
      properties([
          buildDiscarder(logRotator(numToKeepStr: '5', artifactNumToKeepStr: '5')),
          pipelineTriggers([[$class:"SCMTrigger", scmpoll_spec:"H/15 * * * *"]]),
      ])
      
      node('docker') {
          stage('Build') {
              timestamps {
                  checkout scm
                  docker.image('openjdk:8-jdk').inside {
                      sh './gradlew --no-daemon --info war'
                      archiveArtifacts artifacts: 'build/libs/*.war', fingerprint: true
                  }
              }
          }
      
          def container
          stage('Prepare Container') {
              timestamps {
                  sh 'git rev-parse HEAD > GIT_COMMIT'
                  shortCommit = readFile('GIT_COMMIT').take(6)
                  def imageTag = "${env.BUILD_ID}-build${shortCommit}"
                  echo "Creating the container ${imageName}:${imageTag}"
                  container = docker.build("${imageName}:${imageTag}")
              }
          }
      
          stage('Validate') {
              timestamps {
                  sh 'make check'
              }
          }
      
          /* Assuming we're not inside of a pull request or multibranch pipeline */
          if (!(env.CHANGE_ID || env.BRANCH_NAME)) {
              stage('Publish container') {
                  infra.withDockerCredentials {
                      timestamps { container.push() }
                  }
              }
          }
      }
      

        Attachments

          Issue Links

            Activity

            rtyler R. Tyler Croy created issue -
            rtyler R. Tyler Croy made changes -
            Field Original Value New Value
            Link This issue relates to JENKINS-48581 [ JENKINS-48581 ]

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              rtyler R. Tyler Croy
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: