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

Job builds tags even though there is no change in Bitbucket

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • git-plugin
    • RHEL 7
      Jenkins Version: Jenkins ver. 2.184
      Bitbucket Version: Bitbucket v5.16.2
      Git-Plugin

      Hello Team,

      Jenkins job configured to trigger jobs when there is any SCM change in bitbucket repository. But Jenkins job triggered even though there is no change in Bitbucket. When we see commit if commit message that was done on 3 years back. This is happening in one job for specific tags in bitbucket that those are created 3 years back.
      Please find attached screen shots for Jenkins job git configuration options and git plugin version details which are installed in Jenkins.

      jenkins job console startup logs.
      =======
      20:01:28 Started by an SCM change
      20:01:28 Running as SYSTEM
      20:01:28 [EnvInject] - Loading node environment variables.
      =======
      It happen twise in last 15 days. Need your support to find the cause.
      Thanks in Advance !!!

          [JENKINS-60090] Job builds tags even though there is no change in Bitbucket

          Mark Waite added a comment - - edited

          Please provide enough details so that someone other than the original submitter can duplicate the problem.

          Ideally, provide a series of numbered steps describing what was done, what was observed, and the desired result that should have been seen instead of what was actually observed.

          Some specific questions include:

          • Is this a Freestyle job, a Pipeline job, a Multibranch Pipeline job, an Organization Folder Pipeline job, or some other type of job?
          • What is the config.xml file that describes the job?
          • Are the agents which perform the builds ephemeral or static agents?
          • If the agents are static, were any of them recently deleted, damaged, or destroyed?
          • Have you enabled fetching of tags in the job, in addition to configuring the refspec to retrieve tags?
          • Are there other changes in the repository which might be associated with the rebuild of the tag?
          • Was the history retention of the Jenkins job changed recently so that existing history which included those previously built tags might have been deleted? (Git tags do not in general have a concept of `date`. The git plugin as you've configured it probably attempts to build all tags detected in the remote repository which have not been previously built in this job. If history were deleted for the job, then that tag may longer be considered "already built" and may be built again)

          Mark Waite added a comment - - edited Please provide enough details so that someone other than the original submitter can duplicate the problem. Ideally, provide a series of numbered steps describing what was done , what was observed, and the desired result that should have been seen instead of what was actually observed. Some specific questions include: Is this a Freestyle job, a Pipeline job, a Multibranch Pipeline job, an Organization Folder Pipeline job, or some other type of job? What is the config.xml file that describes the job? Are the agents which perform the builds ephemeral or static agents? If the agents are static, were any of them recently deleted, damaged, or destroyed? Have you enabled fetching of tags in the job, in addition to configuring the refspec to retrieve tags? Are there other changes in the repository which might be associated with the rebuild of the tag? Was the history retention of the Jenkins job changed recently so that existing history which included those previously built tags might have been deleted? (Git tags do not in general have a concept of `date`. The git plugin as you've configured it probably attempts to build all tags detected in the remote repository which have not been previously built in this job. If history were deleted for the job, then that tag may longer be considered "already built" and may be built again)

          Hello markewaite,

          Please find the details below.

          • Is this a Freestyle job, a Pipeline job, a Multibranch Pipeline job, an Organization Folder Pipeline job, or some other type of job?  --> It is Freestyle Job.
          • What is the config.xml file that describes the job? --> Please find attached Job config.xml file.
          • Are the agents which perform the builds ephemeral or static agents? --> Static Agents(Windows 10)
          • If the agents are static, were any of them recently deleted, damaged, or destroyed? --> No
          • Have you enabled fetching of tags in the job, in addition to configuring the refspec to retrieve tags? --> Yes
          • Are there other changes in the repository which might be associated with the rebuild of the tag? --> No
          • Was the history retention of the Jenkins job changed recently so that existing history which included those previously built tags might have been deleted? (Git tags do not in general have a concept of `date`. The git plugin as you've configured it probably attempts to build all tags detected in the remote repository which have not been previously built in this job. If history were deleted for the job, then that tag may longer be considered "already built" and may be built again) --> Job configured to build if there is any new tag created in branch. Currently i have only last 30 Builds in my jenkins but i have tags more than that in my branch. It is not triggering for all tags it is picking few tags and building the jobs. Git settings screen shot i have attached(Jenkins_Git_Options.PNG) screen shot.

          Thanks.

          Jagadeeswar Reddy added a comment - Hello markewaite , Please find the details below. Is this a Freestyle job, a Pipeline job, a Multibranch Pipeline job, an Organization Folder Pipeline job, or some other type of job?  --> It is Freestyle Job. What is the config.xml file that describes the job? --> Please find attached Job config.xml file. Are the agents which perform the builds ephemeral or static agents? --> Static Agents(Windows 10) If the agents are static, were any of them recently deleted, damaged, or destroyed? --> No Have you enabled fetching of tags in the job, in addition to configuring the refspec to retrieve tags? --> Yes Are there other changes in the repository which might be associated with the rebuild of the tag? --> No Was the history retention of the Jenkins job changed recently so that existing history which included those previously built tags might have been deleted? (Git tags do not in general have a concept of `date`. The git plugin as you've configured it probably attempts to build all tags detected in the remote repository which have not been previously built in this job. If history were deleted for the job, then that tag may longer be considered "already built" and may be built again) --> Job configured to build if there is any new tag created in branch. Currently i have only last 30 Builds in my jenkins but i have tags more than that in my branch. It is not triggering for all tags it is picking few tags and building the jobs. Git settings screen shot i have attached(Jenkins_Git_Options.PNG) screen shot. Thanks.

          Mark Waite added a comment -

          I suspect you are relying on the JENKINS-19022 bug which causes build history from earlier builds to be incorrectly included in later build records. The git plugin does not have a concept of the "age" of a tag or of the "create date" of a tag. The git plugin has a concept that a SHA1 has already been built or has not already been built. In your case, my guess would be that the SHA-1 hashes from the very old builds had been copied into later build records due to JENKINS-19022. A further guess is that the build records which contained those old records have now expired off the end of the list.

          If my theory is correct, then you should be able to prevent future rebuilds of old tags by retaining all history for that job.

          Mark Waite added a comment - I suspect you are relying on the JENKINS-19022 bug which causes build history from earlier builds to be incorrectly included in later build records. The git plugin does not have a concept of the "age" of a tag or of the "create date" of a tag. The git plugin has a concept that a SHA1 has already been built or has not already been built. In your case, my guess would be that the SHA-1 hashes from the very old builds had been copied into later build records due to JENKINS-19022 . A further guess is that the build records which contained those old records have now expired off the end of the list. If my theory is correct, then you should be able to prevent future rebuilds of old tags by retaining all history for that job.

          Mark Waite added a comment -

          Resolving this as "Not a defect" because it is how the plugin is intended to work.

          Mark Waite added a comment - Resolving this as "Not a defect" because it is how the plugin is intended to work.

            Unassigned Unassigned
            kjagadesh Jagadeeswar Reddy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: