We have the following case: all backstage entity definitions are hosted in a gitlab monorepo, but the actual source code for the entities is hosted in another repo, or even another src code hosting tool. The entities are registered via a all.yaml in the monorepo.
The GitlabFillerProcessorModule is adding the gitlab.com annotations assuming that the source code is hosted in the same repo, resulting in erroneous display of assets, i.e: the EntityGitlabReadmeCard is displaying the readme.md of the gitlab monorepo in the entity page, rather than the target source code repo.
The gitlabInstanceConfig inference should be changed to consider the backstage.io/source-location as the ultimate information to the actual hosting of the source code for the entity.
Background
We have the following case: all backstage entity definitions are hosted in a gitlab monorepo, but the actual source code for the entities is hosted in another repo, or even another src code hosting tool. The entities are registered via a all.yaml in the monorepo. The GitlabFillerProcessorModule is adding the gitlab.com annotations assuming that the source code is hosted in the same repo, resulting in erroneous display of assets, i.e: the EntityGitlabReadmeCard is displaying the readme.md of the gitlab monorepo in the entity page, rather than the target source code repo.
Reproducing
Given that the following YAMLs are hosted in https://gitlab.acme.com/software-catalog:
all.yaml
my-entity.yaml
When https://gitlab.acme.com/software-catalog/all.yaml is registered in backstage Then I expect to see in my-entity page the Readme.md from https://gitlab.acme.com/my-namespace/my-entity/-/blob/main/
Suggested fix
The
gitlabInstanceConfig
inference should be changed to consider thebackstage.io/source-location
as the ultimate information to the actual hosting of the source code for the entity.See: https://github.com/immobiliare/backstage-plugin-gitlab/blob/829e522cfef1281b1f98b6f5363f2f357056cce0/packages/gitlab-backend/src/processor/processor.ts#L50-L53