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

Wrong path for on-premise BitbucketWeb source files

    XMLWordPrintable

Details

    • 4.7.2

    Attachments

      1. bitbucket_history_dropdown.png
        bitbucket_history_dropdown.png
        40 kB
      2. bitbucket_history.png
        bitbucket_history.png
        47 kB
      3. bitbucket-changes-url.JPG
        bitbucket-changes-url.JPG
        29 kB
      4. bitbucket-details.JPG
        bitbucket-details.JPG
        42 kB
      5. bitbucket-org-diff.png
        bitbucket-org-diff.png
        98 kB
      6. bitbucket-org-file-history.png
        bitbucket-org-file-history.png
        73 kB
      7. branch-source-with-repository-browser.png
        branch-source-with-repository-browser.png
        24 kB
      8. changes_page.png
        changes_page.png
        49 kB
      9. changes-with-hyperlinks.png
        changes-with-hyperlinks.png
        38 kB
      10. first_run.png
        first_run.png
        25 kB
      11. hover_link.png
        hover_link.png
        37 kB
      12. job_configuration.png
        job_configuration.png
        88 kB
      13. job_result.png
        job_result.png
        38 kB
      14. job-results-no-link-on-changed-file.png
        job-results-no-link-on-changed-file.png
        42 kB
      15. screenshot-1.png
        screenshot-1.png
        32 kB

      Activity

        markewaite Mark Waite added a comment - - edited

        I can't duplicate the problem you're reporting. I've attached screen shots of my two attempts, one through the "Changes" link and the other through the "Recent Changes" link.

        Changes

        Change Details

        I'll need more details of the steps you take to reach those links.

        All the links I could find in those two screenshots were without any "/history/" in the URL.

        markewaite Mark Waite added a comment - - edited I can't duplicate the problem you're reporting. I've attached screen shots of my two attempts, one through the "Changes" link and the other through the "Recent Changes" link. Changes Change Details I'll need more details of the steps you take to reach those links. All the links I could find in those two screenshots were without any "/history/" in the URL.
        forster_ch Christoph Forster added a comment - - edited

        I have the following Setup:

        • Jenkins 2.32
        • Git Plugin 3.0.0
        • Pipeline Plugin 2.4 (Pipeline SCM Plugin 2.3)
        • Atlassian Bitbucket v4.9.1

        MyPipeline Source looks like

        checkout([$class: 'GitSCM', branches: [[name: '*/develop']],
        	userRemoteConfigs: [[url: 'ssh://git@myBitbucket/myProject/myRepository.git']],
        	browser: [$class: 'BitbucketWeb', repoUrl: 'https://myBitbucket/projects/myProject/repos/myRepository']]
        )
        

        I highlighted the Link and the Result

        I also tried to create a new Job and a new Repository with the same effect (even if I only have a master)

        forster_ch Christoph Forster added a comment - - edited I have the following Setup: Jenkins 2.32 Git Plugin 3.0.0 Pipeline Plugin 2.4 (Pipeline SCM Plugin 2.3) Atlassian Bitbucket v4.9.1 MyPipeline Source looks like checkout([$class: 'GitSCM' , branches: [[name: '*/develop' ]], userRemoteConfigs: [[url: 'ssh: //git@myBitbucket/myProject/myRepository.git' ]], browser: [$class: 'BitbucketWeb' , repoUrl: 'https: //myBitbucket/projects/myProject/repos/myRepository' ]] ) I highlighted the Link and the Result I also tried to create a new Job and a new Repository with the same effect (even if I only have a master)
        markewaite Mark Waite added a comment -

        I can see a reference to the word "history" in the BitBucketWeb implementation inside the git plugin, but am unable to find a path that will generate that link.

        Can you please provide a numbered, step by step series of instructions which show how you configure the job and then reach that details page? I don't want to change that URL in BitBucketWeb unless I can see the old failing behavior, and can then verify the new behavior after a change to fix the problem.

        I've inserted my various attempts into my jenkins-bugs JENKINS-39905 branch (and in the GitHub repo branch), and am referencing that job in a multi-branch pipeline job in my Docker instance.

        markewaite Mark Waite added a comment - I can see a reference to the word "history" in the BitBucketWeb implementation inside the git plugin, but am unable to find a path that will generate that link. Can you please provide a numbered, step by step series of instructions which show how you configure the job and then reach that details page? I don't want to change that URL in BitBucketWeb unless I can see the old failing behavior, and can then verify the new behavior after a change to fix the problem. I've inserted my various attempts into my jenkins-bugs JENKINS-39905 branch (and in the GitHub repo branch), and am referencing that job in a multi-branch pipeline job in my Docker instance .
        forster_ch Christoph Forster added a comment - - edited
        1. Create a new Repository "TestRepo" in Bitbucket
        2. Add some content in the Repository
        3. Create a new Pipeline Job containing the following code:
          node {
              stage('Checkout') {
                  checkout([$class: 'GitSCM', branches: [[name: '*/master']],
                  userRemoteConfigs: [[url: 'ssh://git@mybitbucket.domain.com/myProject/testrepo.git']],
                  browser: [$class: 'BitbucketWeb', repoUrl: 'https://mybitbucket.domain.com/projects/myProject/repos/testrepo']]
                  )
              }
          }
          
        4. keep the rest of the pipeline default (nothing else activated except "Groovy Sandbox")
        5. run the Job - Pipeline must show "No Changes" because it's the first run
        6. add a new file "updated.txt" to TestRepo
        7. Run Job again - Pipeline now shows 1 Change (Job Number is 3 because on 2 i forgot to push)
        8. Hover the Change and select the link "see detail page"
        9. The resulting "Changes Page" shows the history link

        Same Change Page is generated if I select the Job-Number and then select "Changes" in the Menu or "details" on the Change overview

        forster_ch Christoph Forster added a comment - - edited Create a new Repository "TestRepo" in Bitbucket Add some content in the Repository Create a new Pipeline Job containing the following code: node { stage( 'Checkout' ) { checkout([$class: 'GitSCM' , branches: [[name: '*/master' ]], userRemoteConfigs: [[url: 'ssh: //git@mybitbucket.domain.com/myProject/testrepo.git' ]], browser: [$class: 'BitbucketWeb' , repoUrl: 'https: //mybitbucket.domain.com/projects/myProject/repos/testrepo' ]] ) } } keep the rest of the pipeline default (nothing else activated except "Groovy Sandbox") run the Job - Pipeline must show "No Changes" because it's the first run add a new file "updated.txt" to TestRepo Run Job again - Pipeline now shows 1 Change (Job Number is 3 because on 2 i forgot to push) Hover the Change and select the link "see detail page" The resulting "Changes Page" shows the history link Same Change Page is generated if I select the Job-Number and then select "Changes" in the Menu or "details" on the Change overview
        markewaite Mark Waite added a comment - - edited

        Thanks for the detailed description. It confirms that I was using the correct steps previously to reach the page. I don't get a hyperlink on the changed file in the details page unless I define the "Repository Browser" as BitbucketWeb in the definition of the pipeline job.

        When I define the "Repository Browser" as BitBucketWeb in the pipeline job definition, then I get a hyperlink for the file (which links to its history) and a hyperlink for the diff (which links to the differences between that file and the previous version of that file).

        When I define the "Repository Browser" as BitBucketWeb, the file history link and the differences link both direct me to the correct page on bitbucket.org.

        Since the history and difference links work for me using bitbucket.org and don't work for you with your on-premises version, I wonder if you're running an older version of bitbucket in your on-premises installation. Can you confirm the bitbucket version you're running on-premises? I don't see a version number in the online help for https://bitbucket.org/, but I am using https://bitbucket.org for my tests, rather than an on-premises version.

        markewaite Mark Waite added a comment - - edited Thanks for the detailed description. It confirms that I was using the correct steps previously to reach the page. I don't get a hyperlink on the changed file in the details page unless I define the "Repository Browser" as BitbucketWeb in the definition of the pipeline job. When I define the "Repository Browser" as BitBucketWeb in the pipeline job definition, then I get a hyperlink for the file (which links to its history) and a hyperlink for the diff (which links to the differences between that file and the previous version of that file). When I define the "Repository Browser" as BitBucketWeb, the file history link and the differences link both direct me to the correct page on bitbucket.org. Since the history and difference links work for me using bitbucket.org and don't work for you with your on-premises version, I wonder if you're running an older version of bitbucket in your on-premises installation. Can you confirm the bitbucket version you're running on-premises? I don't see a version number in the online help for https://bitbucket.org/ , but I am using https://bitbucket.org for my tests, rather than an on-premises version.

        Yes I can confirm my on-premise Bitbucket Version as "Atlassian Bitbucket v4.9.1"

        I guess the problem is, that on the on-premise Version there is no "History" Page as on bitbucket.org.
        If you want to show the history of a File you only have a dropdown.

        The difference is the following:

        Bitbucket Type link Behaviour
        bitbucket.org https://bitbucket.org/username/myRepo/history/package/of/java/class.java Lists all Commits of the File
        On Premise Bitbucket https://myhostedbitbucket/projects/myProject/repos/myRepo/browse/package/of/java/class.java Shows latest File-Content with dropdown for history
        forster_ch Christoph Forster added a comment - Yes I can confirm my on-premise Bitbucket Version as "Atlassian Bitbucket v4.9.1" I guess the problem is, that on the on-premise Version there is no "History" Page as on bitbucket.org. If you want to show the history of a File you only have a dropdown. The difference is the following: Bitbucket Type link Behaviour bitbucket.org https://bitbucket.org/username/myRepo/history/package/of/java/class.java Lists all Commits of the File On Premise Bitbucket https://myhostedbitbucket/projects/myProject/repos/myRepo/browse/package/of/java/class.java Shows latest File-Content with dropdown for history
        markewaite Mark Waite added a comment -

        The bitbucket release notes list releases 4.10 and 4.11, but 4.9 was only released about 6 months ago. I'm reasonably confident the history link was working as expected on the hosted bitbucket.org at the time bitbucket 4.9 was released. Unfortunately, that means that I don't know what can be done to resolve the issue for you.

        You might check with your bitbucket administrators to see if they have somehow enabled a setting which alters the behavior of the history links.

        markewaite Mark Waite added a comment - The bitbucket release notes list releases 4.10 and 4.11, but 4.9 was only released about 6 months ago. I'm reasonably confident the history link was working as expected on the hosted bitbucket.org at the time bitbucket 4.9 was released. Unfortunately, that means that I don't know what can be done to resolve the issue for you. You might check with your bitbucket administrators to see if they have somehow enabled a setting which alters the behavior of the history links.
        mark_clark_jk Mark Clark added a comment -

        It has been a couple of years, so I don't know if this was the original cause of the problem. However, I contacted Atlassian/Bitbucket and was able to confirm that this behavior is related to the "New Source Browser Experience". When I disabled this feature (in the Bitbucket Labs page of my accounts settings), I was able to see the expected commit history of the specific file.

        It also appears that this is NOT the desired effect of the New Source Browser Experience. So I am expecting some time in the future, this will be fixed in Bitbucket and we will not need to disable New Source Browser Experience in order for this history link to work.

        mark_clark_jk Mark Clark added a comment - It has been a couple of years, so I don't know if this was the original cause of the problem. However, I contacted Atlassian/Bitbucket and was able to confirm that this behavior is related to the "New Source Browser Experience". When I disabled this feature (in the Bitbucket Labs page of my accounts settings), I was able to see the expected commit history of the specific file. It also appears that this is NOT the desired effect of the New Source Browser Experience. So I am expecting some time in the future, this will be fixed in Bitbucket and we will not need to disable New Source Browser Experience in order for this history link to work.

        PR #1071 was included in Git Plugin 4.7.2 and presumably fixes this. markewaite, can this issue be closed now?

        kon Kalle Niemitalo added a comment - PR #1071 was included in Git Plugin 4.7.2 and presumably fixes this. markewaite , can this issue be closed now?

        Bitbucket Server is the current name of the software that used to be called Stash. There are a few differences between BitbucketServer.java and Stash.java:

        • BitbucketServer.getDiffLink links to the per-commit page and selects the file from there, while Stash.getDiffLink links to the per-file page and selects the diff from there. OK, perhaps the per-commit page is better for showing that a file was renamed or deleted.
        • BitbucketServer.getFileLink does not add the commit ID as an "at" query parameter. That seems bad.
        • getDisplayName() of the descriptor returns "bitbucketserver" vs. "stash". OK.
        kon Kalle Niemitalo added a comment - Bitbucket Server is the current name of the software that used to be called Stash. There are a few differences between BitbucketServer.java and Stash.java : BitbucketServer.getDiffLink links to the per-commit page and selects the file from there, while Stash.getDiffLink links to the per-file page and selects the diff from there. OK, perhaps the per-commit page is better for showing that a file was renamed or deleted. BitbucketServer.getFileLink does not add the commit ID as an "at" query parameter. That seems bad. getDisplayName() of the descriptor returns "bitbucketserver" vs. "stash". OK.
        kon Kalle Niemitalo added a comment - - edited

        In general, you shouldn't test against Bitbucket Cloud if you want to know how things work in Bitbucket Data Center and Server. Although the names are confusingly similar, they are separate implementations in different programming languages.

        kon Kalle Niemitalo added a comment - - edited In general, you shouldn't test against Bitbucket Cloud if you want to know how things work in Bitbucket Data Center and Server. Although the names are confusingly similar, they are separate implementations in different programming languages.
        markewaite Mark Waite added a comment -

        Thanks for detecting that this issue can be closed kon. Much appreciated!

        markewaite Mark Waite added a comment - Thanks for detecting that this issue can be closed kon . Much appreciated!

        People

          Unassigned Unassigned
          forster_ch Christoph Forster
          Votes:
          0 Vote for this issue
          Watchers:
          5 Start watching this issue

          Dates

            Created:
            Updated:
            Resolved: