Cannot edit bitbucket URL

Issue #52 new
Ronan Jordan created an issue

After adding URL , reset button does not do anything except clearing the branch name and cannot edit or add different bitbucket URL.

Comments (20)

  1. Daniil Penkin staff

    Hello there,

    I'm very sorry, I somehow missed this issue when looking at the board.

    Thanks for reporting this. I actually took many shortcuts in Linky configuration screens and never came back to redo them properly. There's indeed no way to reset configured Bitbucket URL from UI, at the moment you can only do that by editing (or removing) some files where Linky stores these settings. Here's a step-by-step guide:

    • Close the IDE. Otherwise the settings you change might be overridden with the old values when the IDE gets focus back or when it quits.
    • Navigate to /Users/<your_user>/Library/Preferences/<ide_with_version>/options/, in my case it's /Users/dpenkin/Library/Preferences/IntelliJIdea2018.3/options/.
    • There will be two files that Linky uses: bitbucket-cloud-registry.xml and bitbucket-server-registry.xml which keep the registry of discovered Bitbucket Cloud and Bitbucket Server instances, respectively.
    • Settings file is an XML file. You need to find the record element that defines the pattern you've misconfigured — it will be under application/component/lookup/record. You can tweak that record in place or just remove it to be able to re-link the repo later in the IDE Settings UI.
    • Once you edited and saved the file, you can reopen your IDE. Depending on what you did on previous step, Linky will either point to the correct location or will revert the settings screen to the state shown on the second screenshot above.

    Note that when you change the pattern, it will affect all repositories with similar pattern. I mean that Linky doesn't actually link a repo to a remote hosting but rather remembers the pattern of the remote URL, but that's probably what you want anyway.

    As for the Reset button you see in the UI, it is a standard thing IntelliJ shows when you edit the screen – it only resets what you've done since you last pressed Apply or OK, i.e. it doesn't really reset any saved settings.

    I'll change this ticket to an improvement and will keep it. One day I'll get back to the configuration screens :)

    Cheers, Daniil

  2. Mikhail B

    Thanks, Daniil, reseting in such way fixed the issue for me, after it I left "Automatic" option there in settings and it works so far

  3. Daniil Penkin staff

    Glad to hear it worked @yetanothercoderu . Hopefully one day I'll feel brave enough to tackle these screens =D

  4. Daniil Penkin staff

    Hi @Zescher,

    What do you mean when you say it's not working? Does it use the old URL in the generated links? Or does it not show the actions at all?

    Are you able to save the URL you mentioned in Linky settings?

    Cheers, Daniil

  5. Zakaria Boutami

    Hi Daniil,

    The Bitbucket URL is set to https://bitbucket:433/projects/${projectKey}/repos/${repoSlug} instead of https://www.mycompanyname.com/bitbucket/projects/${projectKey}/repos/${repoSlug}

    I'm editing bitbucket-linky.xml like this:

      <component name="BitbucketServerRegistry">
        <instances>
          <instance baseUri="https://www.mycompanyname.com/bitbucket" />
        </instances>
        <lookup>
          <record scheme="ssh" hostname="www.companyname.com" port="7999" path="/" uuid="33cddaf6-c274-3992-842a-bc49f7111162" />
        </lookup>
      </component>
    

    But after saving the file and opening IntelliJ, the baseUri attribute is automatically changed to https://bitbucket:433/

    Regards, Zakaria

  6. Daniil Penkin staff

    Hi @Zescher,

    TL;DR I believe your config should look like this:

    <component name="BitbucketServerRegistry">
        <instances>
          <instance uuid="33cddaf6-c274-3992-842a-bc49f7111162" baseUri="https://www.mycompanyname.com/bitbucket" />
        </instances>
        <lookup>
          <record scheme="ssh" hostname="bitbucket" port="7999" path="/" uuid="33cddaf6-c274-3992-842a-bc49f7111162" />
        </lookup>
      </component>
    

    Your config excerpt looks wrong:

    1. instances.instance should have uuid attribute, without it Linky won't be able to match that instance with records from lookup, so it'll ignore it and rediscover Bitbucket, overriding any changes.
    2. The lookup.record[hostname] attribute should match your Git repo remote URL, not the actual Bitbucket address. lookup is used to find Bitbucket by parameters parsed from repository remote URL. Unless your remote looks something like ssh://git@www.companyname.com:7999/..., the record[hostname] should be bitbucket – this is what Linky discovered automatically, so I assume your remote rather looks like ssh://git@bitbucket:7999/... . Since Linky checks the base URL by trying some REST API endpoints, I assume you have a DNS/hosts record pointing bitbucket to address of www.companyname.com, as well as SSH configuration with a similar alias – am I correct?

    Cheers, Daniil

  7. Zakaria Boutami

    Hi @dpenkin,

    I changed my config like you suggested except for hostname attribute because my remote is indeed like ssh://git@www.companyname.com:7999/...

    After saving the changes and restaring IntelliJ instance everything worked fine!

    Just for you to know, I had to add uuid attribute manually (key and value) to instance node, and the Bitbucket URL displayed in UI configuration is: https://www.mycompanyname.com:443/bitbucket/projects/${projectKey}/repos/${repoSlug}

    Thank you very much for your help!

    Regards, Zak

  8. Zakaria Boutami

    Hi again,

    After opening the XML configuration file, I noticed that uuid attribute was automatically removed from instance node.

    The XML configuration looks like this right now:

      <component name="BitbucketServerRegistry">
        <instances>
          <instance baseUri="https://www.mycompanyname.com:443/bitbucket" />
        </instances>
        <lookup>
          <record scheme="ssh" hostname="www.companyname.com" port="7999" path="/" uuid="33495c40-bbd4-3733-8232-9f38276daf33" />
        </lookup>
      </component>
    
  9. Daniil Penkin staff

    Hi @Zescher,

    Hm, this doesn't look right. May I ask you which Linky version are you facing this issue with? You can check it in IDE Preferences -> Plugins -> Installed -> Bitbucket Linky.

    Meanwhile I'll look into how this might be happening.

    Cheers, Daniil

  10. Daniil Penkin staff

    Hi @Zescher,

    Thanks for confirming the version.

    I found and fixed this issue, please upgrade to version 6.2. If automatic discovery won't work, you can change in that file once again, and it should be preserved.

    Sorry for the inconvenience.

    Cheers, Daniil

  11. Horia Constantin

    In IntelliJ IDEA 2020.1, the settings file is in /Users/<username>/Library/Application\ Support/JetBrains/IntelliJIdea2020.1/options/

  12. Log in to comment