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

any job connected to specific bitbucket repository with "Bitbucket Server" updates last commit status

      Hi there,

      Please help me to understand whether described behavior relates to Bitbucket server integration plugin and if yes - is it a bug?

      Any job connected to specific bitbucket repository with "Bitbucket Server" updates repository last commit (although it is not related to that build) build status each time it runs.

          [JENKINS-69449] any job connected to specific bitbucket repository with "Bitbucket Server" updates last commit status

          hi whitefluffypenguin , can you please share more information like the build type you have used when you encountered the issue and the reproduction steps for this?

          Atlassian Bitbucket Server added a comment - hi whitefluffypenguin , can you please share more information like the build type you have used when you encountered the issue and the reproduction steps for this?

          White Fluffy added a comment - - edited

          Hi there, The impression is that any job connected to specific bitbucket repository with “Bitbucket Server” updates last commit (of mentioned repository) build status. Current testing job is the 'pipeline' one. Reproduction steps are the following: create pipeline job, configure 'Source Code Management' to use 'Bitbucket Server' and specific project and repository, save, launch the job, go to bitbucket commits page of configured repository, find a build notification under the rightest 'Builds' notification column. This build notification has no relation to mentioned commit. It is there just because this commit is the latest at the moment.

          White Fluffy added a comment - - edited Hi there, The impression is that any job connected to specific bitbucket repository with “Bitbucket Server” updates last commit (of mentioned repository) build status. Current testing job is the 'pipeline' one. Reproduction steps are the following: create pipeline job, configure 'Source Code Management' to use 'Bitbucket Server' and specific project and repository, save, launch the job, go to bitbucket commits page of configured repository, find a build notification under the rightest 'Builds' notification column. This build notification has no relation to mentioned commit. It is there just because this commit is the latest at the moment.

          Hi White Fluffy,

          I've tried to follow your replication steps but I'm not really understanding the issue you're describing. Here are the steps I took:

          • Created a pipeline job, configure Pipeline from SCM and configured it with my job. Note I've kept the branch selector as */master, which is the branch that will be build when running the job:
          • Run the job. The commit at the head of master was ff7701abbd4, and visiting the builds page a build status was sent to that commit
          • I added two more commits to master 98067d84b22 and 37efe12f3da, and ran the job again. The latter commit was built and a build status was sent to that on bitbucket.
            The below screenshot shows both build statuses on the commits page:

          This is expected behaviour. When Jenkins kicks a build, the latest commit is picked up to build. Quoting from your question:

          > This build notification has no relation to mentioned commit. It is there just because this commit is the latest at the moment.

          Can you please elaborate on what you mean here? Your screenshot only shows the commit ID for the job, but you don't show the branch history for your build so I'm not really sure what I'm looking at.

          Martin Henschke added a comment - Hi White Fluffy, I've tried to follow your replication steps but I'm not really understanding the issue you're describing. Here are the steps I took: Created a pipeline job, configure Pipeline from SCM and configured it with my job. Note I've kept the branch selector as */master, which is the branch that will be build when running the job: Run the job. The commit at the head of master was ff7701abbd4, and visiting the builds page a build status was sent to that commit I added two more commits to master 98067d84b22 and 37efe12f3da, and ran the job again. The latter commit was built and a build status was sent to that on bitbucket. The below screenshot shows both build statuses on the commits page: This is expected behaviour. When Jenkins kicks a build, the latest commit is picked up to build. Quoting from your question: > This build notification has no relation to mentioned commit. It is there just because this commit is the latest at the moment. Can you please elaborate on what you mean here? Your screenshot only shows the commit ID for the job, but you don't show the branch history for your build so I'm not really sure what I'm looking at.

          White Fluffy added a comment -

          Hi Martin,
          A few interesting points about expected behavior have been raised - please help me to understand something.
          Suppose there is a repository that includes mixed sources (in our case the devops ones: various groovy, python, docker files) that support different functionality and are used by different jenkins jobs - can it happen?
          If one of these jobs is configured to check out repository sources - should we presume the latest commit of that repository certainly relates to the functionality implemented in this job (in my eyes not always)?
          You also asked about "branch history for your build" - we are using bitbucket feature branch workflow https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow
          however, assuming single master branch is safe enough to facilitate the discussion.

          White Fluffy added a comment - Hi Martin, A few interesting points about expected behavior have been raised - please help me to understand something. Suppose there is a repository that includes mixed sources (in our case the devops ones: various groovy, python, docker files) that support different functionality and are used by different jenkins jobs - can it happen? If one of these jobs is configured to check out repository sources - should we presume the latest commit of that repository certainly relates to the functionality implemented in this job (in my eyes not always)? You also asked about "branch history for your build" - we are using bitbucket feature branch workflow https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow ,  however, assuming single master branch is safe enough to facilitate the discussion.

          Hi again, I'm sorry but I'm really struggling to understand this issue.

          By branch history I mean your git commit history on the related branch, which just mean a list of commits like the screenshot I shared above.

          > Suppose there is a repository that includes mixed sources [...]  can it happen?

          As of right now, multiple Bitbucket Server branch sources is unsupported behaviour, and I cannot make any guarantees of it functioning correctly. I don't have any advice to provide on multiple branch sources, and I recommend opening a feature request if that is functionality you need from the plugin so I can investigate further.

          > If one of these jobs is configured to check out repository sources - should we presume the latest commit of that repository certainly relates to the functionality implemented in this job

          I'm sorry but I just don't understand what this question means. It sounds like you're expecting the latest commit of your repository to somehow reflect or otherwise relate to your job configuration. If you're asking if your Jenkinsfile should be the same as the one that you draw from source, then yes. We always take the Jenkinsfile for a branch source from the same commit.

          > This build notification has no relation to mentioned commit

          This is what I need clarification on. What do you mean by "related to" a given commit? What precisely are you expecting that you're not seeing?

          Martin Henschke added a comment - Hi again, I'm sorry but I'm really struggling to understand this issue. By branch history I mean your git commit history on the related branch, which just mean a list of commits like the screenshot I shared above. > Suppose there is a repository that includes mixed sources [...]  can it happen? As of right now, multiple Bitbucket Server branch sources is unsupported behaviour , and I cannot make any guarantees of it functioning correctly. I don't have any advice to provide on multiple branch sources, and I recommend opening a feature request if that is functionality you need from the plugin so I can investigate further. > If one of these jobs is configured to check out repository sources - should we presume the latest commit of that repository certainly relates to the functionality implemented in this job I'm sorry but I just don't understand what this question means. It sounds like you're expecting the latest commit of your repository to somehow reflect or otherwise relate to your job configuration. If you're asking if your Jenkinsfile should be the same as the one that you draw from source, then yes. We always take the Jenkinsfile for a branch source from the same commit. > This build notification has no relation to mentioned commit This is what I need clarification on. What do you mean by "related to" a given commit? What precisely are you expecting that you're not seeing?

          White Fluffy added a comment - - edited

          1. "branch history" - understood - the linear squashed commits history of master branch - our picture looks very similar
          2. Please define "multiple Bitbucket Server branch sources"?
             We have a single bitbucket server and typical git repository branches and sources are multiple - so what behavior is unsupported?
          3. Single repository includes sources that automate different jenkins jobs. 
             Latest commit doesn't necessarily/always include changes in specific job running script (doesn't always relate to update in sources of specific job build script).
             Therefore updating this commit with notification from job just linked to this (whole) repository is unexpected and misleading.
          4. I am expecting Bitbucket Server Integration plugin will not notify to Bitbucket server based on definition/existense of "Repository name" in "Bitbucket Server" "Source Code Management" jenkins job field only.
             I am probably expecting a configurable option to stop notifications to bitbucket server if, in developer eyes, marking latest commit by specific job notification is misleading.
             Ideally i would probably expect comparing specific job "Recent Changes" and "Script Path" with branch commits content and notifying relevant commits only if there is a match. 

          Hope this is more clear!    
           

          White Fluffy added a comment - - edited 1. "branch history" - understood - the linear squashed commits history of master branch - our picture looks very similar 2. Please define "multiple Bitbucket Server branch sources"?    We have a single bitbucket server and typical git repository branches and sources are multiple - so what behavior is unsupported? 3. Single repository includes sources that automate different jenkins jobs.     Latest commit doesn't necessarily/always include changes in specific job running script (doesn't always relate to update in sources of specific job build script).    Therefore updating this commit with notification from job just linked to this (whole) repository is unexpected and misleading. 4. I am expecting Bitbucket Server Integration plugin will not notify to Bitbucket server based on definition/existense of "Repository name" in "Bitbucket Server" "Source Code Management" jenkins job field only.    I am probably expecting a configurable option to stop notifications to bitbucket server if, in developer eyes, marking latest commit by specific job notification is misleading.    Ideally i would probably expect comparing specific job "Recent Changes" and "Script Path" with branch commits content and notifying relevant commits only if there is a match.  Hope this is more clear!      

            Unassigned Unassigned
            whitefluffypenguin White Fluffy
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: