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

Multibranch pipeline - existing branch seen as first time build

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Labels:
      None
    • Environment:
      git-plugin:4.0.0 git-client-plugin:3.0.0. Jenkins:2.204. AWS Linux AMI 2.
    • Similar Issues:

      Description

      Sometimes when building an existing multi-branch pipeline, the build is incorrectly regarded as first-time. The console log shows "First time build. Skipping changelog." ,and the build-overview says "no changes", both incorrectly.

       

      This results in confusion whether commits/merges have been done correctly as they are not visible.

        Attachments

          Activity

          Hide
          markewaite Mark Waite added a comment - - edited

          Can you provide more details about conditions that might cause a build to be identified as a first-time build?

          Were there specific changes that happened at the time in the git repository, in the job definition, or in the agent definitions?

          Are you using ephemeral or static agents?

          I inserted detection checks into several of my test jobs in hopes of seeing it, but did not see it. Will need more details in order to duplicate the problem.

          Any other hints that might make the problem repeatable?

          Show
          markewaite Mark Waite added a comment - - edited Can you provide more details about conditions that might cause a build to be identified as a first-time build? Were there specific changes that happened at the time in the git repository, in the job definition, or in the agent definitions? Are you using ephemeral or static agents? I inserted detection checks into several of my test jobs in hopes of seeing it, but did not see it. Will need more details in order to duplicate the problem. Any other hints that might make the problem repeatable?
          Hide
          thomasminke Thomas Minke added a comment -

          Hi Mark Waite, thanks for your quick response. I'm looking for more info to reproduce this issue, but I'm afraid I've got very little.

          • Today, 4 out of 5 builds show as 'first-time' in the console logs, and 1 shows a changelog.
          • These builds were both after branch merges and direct commits. Nothing irregular in the Git repository as far as I can see.
          • The Jenkinsfile was not changed in all of the builds.
          • We use a static agent with one SSH slave. All 5 builds that I started today ran on this SSH slave.  

          Do you have any hints which information would be relevant for reproducing or debugging? 

          Show
          thomasminke Thomas Minke added a comment - Hi Mark Waite , thanks for your quick response. I'm looking for more info to reproduce this issue, but I'm afraid I've got very little. Today, 4 out of 5 builds show as 'first-time' in the console logs, and 1 shows a changelog. These builds were both after branch merges and direct commits. Nothing irregular in the Git repository as far as I can see. The Jenkinsfile was not changed in all of the builds. We use a static agent with one SSH slave. All 5 builds that I started today ran on this SSH slave.   Do you have any hints which information would be relevant for reproducing or debugging? 
          Hide
          thomasminke Thomas Minke added a comment -

          Mark Waite, one other thing: we have another issue at the moment regarding Git checkout. Sometimes the checkout fails with an error message, without failing the build. This results in a deployment of the code without updating. I will create a separate issue for this, but it might be related.

          Show
          thomasminke Thomas Minke added a comment - Mark Waite , one other thing: we have another issue at the moment regarding Git checkout. Sometimes the checkout fails with an error message, without failing the build. This results in a deployment of the code without updating. I will create a separate issue for this, but it might be related.
          Hide
          markewaite Mark Waite added a comment -

          I'm not aware of cases where a checkout fails and does not fail the build. Definitely provide examples of the problem in a separate issue.

          Show
          markewaite Mark Waite added a comment - I'm not aware of cases where a checkout fails and does not fail the build. Definitely provide examples of the problem in a separate issue.
          Hide
          mkroell Michael Kroell added a comment -

          I wanted to report I am experiencing this issue as well, which results in some plugins for Jira not working.

          Show
          mkroell Michael Kroell added a comment - I wanted to report I am experiencing this issue as well, which results in some plugins for Jira not working.
          Hide
          avee Arjan Veenstra added a comment -

          I'm using the 'Bitbucket Branch Source' plugin and see this on all builds, all branches and can't find any way to make it record changes. I fiddled with pretty much any git setting/extension I could find, it just keeps telling me "First time build. Skipping changelog."

          It seems to have something to do with not being able to determine the revision of the previous build. What does work is overriding the checkout and getting changes against a specific branch:
          {{
          options

          { skipDefaultCheckout(true) }

          stages {
          stage('Setup') {
          steps {

          checkout(changelog: true, scm:[
          $class: 'GitSCM',
          branches: scm.branches,
          doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations,
          extensions: [[$class: 'ChangelogToBranch', options: [compareRemote: 'origin', compareTarget: 'master']],[$class: 'AuthorInChangelog'], [$class: 'CloneOption', noTags: false, reference: '', shallow: false], [$class: 'CleanBeforeCheckout']],
          userRemoteConfigs: scm.userRemoteConfigs
          ])
          }}
          Based of https://devops.stackexchange.com/questions/4379/jenkins-shows-no-changes-in-any-of-the-builds
          However that shows way to many changes.

          Another observation is that on some projects I use a shared library, changes made to the library do show up. So something works...

          Show
          avee Arjan Veenstra added a comment - I'm using the 'Bitbucket Branch Source' plugin and see this on all builds, all branches and can't find any way to make it record changes. I fiddled with pretty much any git setting/extension I could find, it just keeps telling me "First time build. Skipping changelog." It seems to have something to do with not being able to determine the revision of the previous build. What does work is overriding the checkout and getting changes against a specific branch: {{ options { skipDefaultCheckout(true) } stages { stage('Setup') { steps { checkout(changelog: true, scm:[ $class: 'GitSCM', branches: scm.branches, doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations, extensions: [[$class: 'ChangelogToBranch', options: [compareRemote: 'origin', compareTarget: 'master'] ], [$class: 'AuthorInChangelog'] , [$class: 'CloneOption', noTags: false, reference: '', shallow: false] , [$class: 'CleanBeforeCheckout'] ], userRemoteConfigs: scm.userRemoteConfigs ]) }} Based of https://devops.stackexchange.com/questions/4379/jenkins-shows-no-changes-in-any-of-the-builds However that shows way to many changes. Another observation is that on some projects I use a shared library, changes made to the library do show up. So something works...
          Hide
          eengberg Eric added a comment -

          I am encountering the exact same issue as Arjan.  I'm also using the Bitbucket Branch Source plugin and a shared library.  I'm experiencing this issue on a new instance I'm trying to build to replace our existing one.  The existing jenkins does not experience this issue.  The job configuration between the 2 instances is pretty much identical yet the new kubernetes instance always sees every build as a new build.  Library changes were showing up but I disabled that so that part worked for me as well.

          Show
          eengberg Eric added a comment - I am encountering the exact same issue as Arjan.  I'm also using the Bitbucket Branch Source plugin and a shared library.  I'm experiencing this issue on a new instance I'm trying to build to replace our existing one.  The existing jenkins does not experience this issue.  The job configuration between the 2 instances is pretty much identical yet the new kubernetes instance always sees every build as a new build.  Library changes were showing up but I disabled that so that part worked for me as well.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            thomasminke Thomas Minke
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

              Dates

              Created:
              Updated: