RSC-Labs / backstage-highlights-plugin

Backstage Highlights Plugin is configurable and customizable plugin for viewing the most important information about your entity.
Mozilla Public License 2.0
5 stars 1 forks source link

Clone button only points to gitlab.com not gitlab.customdomain.com #5

Closed nia-potato closed 2 months ago

nia-potato commented 3 months ago

Hi thanks for the plugin,

I have configured the appconfig block

highlights:
  gitlab:
    - host: gitlab.customdomain.com
      token: <PAT>
      apiBaseUrl: https://gitlab.customdomain.com/api/v4

integrations:
  gitlab:
    - host: gitlab.customdomain.com
      token: <PAT>
      apiBaseUrl: https://gitlab.customdomain.com/api/v4
      baseUrl: https://gitlab.customdomain.com

but when i hit the clone button, with the catalog-info.yaml defined with the project slug, it is still showing clone url of gitlab.com/group/project.git where it shouldve been gitlab.customdomain.com/group/project.git

radoslaw-sz commented 3 months ago

hi @nia-potato - thanks for raising this issue. Indeed, the "clone" logic does not contain taking a host from app-config, but only focuses on annotations: https://github.com/RSC-Labs/backstage-highlights-plugin/blob/main/plugins/backstage-highlights-plugin/src/components/GitInfoCloneField.tsx#L36

I will try to fix it, but I cannot promise when. I am focusing on other project now, I need to finally switch to this one and fix all issues..

nia-potato commented 3 months ago

i can try to fix it, if you are busy, but would just like to ask you before i send in a PR.

i see the clone logic is hardcoded here, what annotation in mind do you want to source from the to fix this ?

https://github.com/RSC-Labs/backstage-highlights-plugin/blob/b3b9113afa041f9f981cc4e9947c445d8b7b332a/plugins/backstage-highlights-plugin/src/components/GitInfoCloneField.tsx#L24

should we use backstage.io/source-location: annotation? or did you have something else in mind

radoslaw-sz commented 3 months ago

hi @nia-potato - thanks for the proposal. Of course I am open for the PR. I think we can use gitlab.com/instance annotation which is related to component entity - https://github.com/RSC-Labs/backstage-highlights-plugin?tab=readme-ov-file#catalog-infoyaml. The logic would be: if gitlab.com/instance is present then takes it, if not then go with hardcode gitlab.com.