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

Git plugin incorrectly detects changes in PR with merge conflicts

    Details

    • Similar Issues:

      Description

      The PR-187 job and the PR-182 job for the docker-inbound-agent on ci.jenkins.io runs every 30 minutes or 60 minutes and reports that the commit cannot be merged. The git polling log reports:

      Started on Sep 23, 2020, 12:40:00 AM
      Using strategy: SpecificRevisionBuildChooser
      [poll] Last Built Revision: Revision 6089fb6c8549de12b90e5af4da82ba5ed9dce3e3 (master)
      The recommended git tool is: jgit
      No credentials specified
      Found 9 remote heads on https://github.com/jenkins-infra/pipeline-library.git
      [poll] Latest remote head revision on refs/heads/master is: 368501ef0ff03f3da9468394793cec7032903d68
      Using strategy: SpecificRevisionBuildChooser
      [poll] Last Built Revision: Revision d017b1219df68e5d70b5f7d256c7ec6762fddd3b (PR-182)
      The recommended git tool is: jgit
      using credential github-access-token
      Found 5 remote heads on https://github.com/jenkinsci/docker-inbound-agent.git
      Ignoring refs/heads/jep-15 as it doesn't match any of the configured refspecs
      Ignoring refs/heads/slide-patch-1 as it doesn't match any of the configured refspecs
      Ignoring refs/heads/alpine as it doesn't match any of the configured refspecs
      Ignoring refs/heads/jdk11 as it doesn't match any of the configured refspecs
      Using strategy: SpecificRevisionBuildChooser
      [poll] Last Built Revision: Revision d017b1219df68e5d70b5f7d256c7ec6762fddd3b (PR-182)
      The recommended git tool is: jgit
      using credential github-access-token
      Found 5 remote heads on https://github.com/jenkinsci/docker-inbound-agent.git
      Ignoring refs/heads/jep-15 as it doesn't match any of the configured refspecs
      Ignoring refs/heads/slide-patch-1 as it doesn't match any of the configured refspecs
      Ignoring refs/heads/alpine as it doesn't match any of the configured refspecs
      Ignoring refs/heads/jdk11 as it doesn't match any of the configured refspecs
      Using strategy: SpecificRevisionBuildChooser
      [poll] Last Built Revision: Revision d017b1219df68e5d70b5f7d256c7ec6762fddd3b (PR-182)
      The recommended git tool is: jgit
      using credential github-access-token
      Found 5 remote heads on https://github.com/jenkinsci/docker-inbound-agent.git
      Ignoring refs/heads/jep-15 as it doesn't match any of the configured refspecs
      Ignoring refs/heads/slide-patch-1 as it doesn't match any of the configured refspecs
      Ignoring refs/heads/alpine as it doesn't match any of the configured refspecs
      Ignoring refs/heads/jdk11 as it doesn't match any of the configured refspecs
      Done. Took 0.91 sec
      Changes found
      

      The pipeline definition is a declarative pipeline that looks like this:

      /* NOTE: this Pipeline mainly aims at catching mistakes (wrongly formed Dockerfile, etc.)
       * This Pipeline is *not* used for actual image publishing.
       * This is currently handled through Automated Builds using standard Docker Hub feature
      */
      pipeline {
          agent none
      
          options {
              buildDiscarder(logRotator(daysToKeepStr: '10'))
              timestamps()
          }
      
          triggers {
              pollSCM('H/24 * * * *') // once a day in case some hooks are missed
          }
      
          stages {
              stage('Build Docker Image') {
                  parallel {
                      stage('Windows') {
                          agent {
                              label 'windock'
                          }
                          options {
                              timeout(time: 60, unit: 'MINUTES')
                          }
                          environment {
                              DOCKERHUB_ORGANISATION = "${infra.isTrusted() ? 'jenkins' : 'jenkins4eval'}"
                          }
                          steps {
                              script {
                                  powershell '& ./make.ps1 test'
      
                                  def branchName = "${env.BRANCH_NAME}"
                                  if (branchName ==~ 'master') {
                                      // we can't use dockerhub builds for windows
                                      // so we publish here
                                      infra.withDockerCredentials {
                                          powershell '& ./make.ps1 publish'
                                      }
                                  }
      
                                  def tagName = "${env.TAG_NAME}"
                                  if(tagName =~ /\d(\.\d)+(-\d+)?/) {
                                      // we need to build and publish the tagged version
                                      infra.withDockerCredentials {
                                          powershell "& ./make.ps1 -PushVersions -VersionTag $tagName publish"
                                      }
                                  }
      
                                  powershell '& docker system prune --force --all'
                              }
                          }
                      }
                      stage('Linux') {
                          agent {
                              label "docker&&linux"
                          }
                          options {
                              timeout(time: 30, unit: 'MINUTES')
                          }
                          steps {
                              script {
                                  if(!infra.isTrusted()) {
                                      deleteDir()
                                      checkout scm
                                      sh '''
                                      make build
                                      make test
                                      docker system prune --force --all
                                      '''
                                  }
                              }
                          }
                      }
                  }
              }
          }
      }
      

      I closed PR-187 and noted to the submitter that it could be reopened once the merge conflict is resolved.

        Attachments

          Activity

          Hide
          markewaite Mark Waite added a comment - - edited

          Same condition was seen on Packaging/docker-agent/PR-142 where a merge conflict was causing the multibranch build to incorrectly detect changes every time it polled.

          Same condition is not seen in other cases that have a merge conflict.

          Show
          markewaite Mark Waite added a comment - - edited Same condition was seen on Packaging/docker-agent/PR-142 where a merge conflict was causing the multibranch build to incorrectly detect changes every time it polled. Same condition is not seen in other cases that have a merge conflict.

            People

            • Assignee:
              Unassigned
              Reporter:
              markewaite Mark Waite
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: