loblaw-sre / backstage-plugin-gitlab

Backstage plugin for Gitlab
52 stars 31 forks source link

Feature request: add support for readme.md display #25

Open matus-m opened 2 years ago

matus-m commented 2 years ago

hi, thanks for the gitlab plugin.

This is a feature request to support rendering projects readme on the component entity page - as extra widget probably. Backstage has its own techdocs plugin - but that fulfills different use case then a simple project readme. The gitlab api provides a readme link in the api response as "readme_url" attribute. The idea is to simply fetch the file from the provided location and render it on the component page with markdown renderer.

Thanks

satrox28 commented 2 years ago

Hi @yntelectual thanks for using the plugin. Sure, will check it out on how we can be implemented as at times the docs content might be lengthy.

matus-m commented 2 years ago

Excellent, it could look the same as GitHub Insights https://roadie.io/backstage/plugins/github-insights/?utm_source=backstage.io&utm_medium=marketplace&utm_campaign=github-insights

lackerman commented 2 years ago

I recently created a custom README card plugin partially because the gitlab plugin did not have one and because I wanted to experience the joy/pain/emotions of building a backstage plugin. If y'all want help on this, I'd be happy to contribute.

satrox28 commented 2 years ago

@lackerman we just started working too, sure please contribute.

satrox28 commented 2 years ago

We have pushed our initial changes to readmecard branch, please take a look. @lackerman

satrox28 commented 2 years ago

@lackerman any thoughts on the code?.

lackerman commented 2 years ago

apologies for the delay folks. I'll take a look

lackerman commented 2 years ago

Hi @satrox28, I've found a few things which I've listed below

The following function is unused https://github.com/loblaw-sre/backstage-plugin-gitlab/compare/readmecard#diff-114fb4a3888a2330e12cdfbed9ed5a559193e7ebaf2369451aecce70f38092f7R62-R65

The file path needs to be encoded, as per the Gitlab docs https://github.com/loblaw-sre/backstage-plugin-gitlab/compare/readmecard#diff-a7882c8f358276f83848b82bcdba47fa4cec4a80ccb7b586069eafd1be9a854fR13

Images are not showing up in the README

Screenshot 2021-11-11 at 10 50 34

And the deep link doesn't appear to work. The link rendered does not include the project path http://127.0.0.1:3000/gitlab.internal.com/-/blob/master/README.md I see the use of backstage.io/managed-by-location but no reference to it in the docs.

Otherwise, it looks good, renders better than mine ;)

My only favour would be, could we make it a standalone component (perhaps all the widgets could be standalone) so that I could import them on whichever tab I wanted.

matus-m commented 2 years ago

+1 for the standalone components - right now we either get all gitlab insights in single component or none, it would be great if we could, for example, just take CICD widget and put it on the entity main page. ANd for readme it definitely makes sense - readme is sth that we want to show as soon as possible, not only once user goes to gitlab tab. Thanks for the quick delivery btw

matus-m commented 2 years ago

hi @satrox28 have you had any time to finish the work on this new feature and the export of individual components? Or is there a way we could help? Thanks

satrox28 commented 2 years ago

Hi @yntelectual

We got stuck with few other priorities but please feel to raise a PR if you would like to contribute.

We will for sure look in to it after the holidays.

satrox28 commented 2 years ago

Hi @yntelectual @lackerman

Sorry, we still working on other features. Can you please give it a try.

satrox28 commented 2 years ago

Hi @yntelectual @lackerman Exporting the individual cards is released on v0.1.21, please check the readme on how to use it.

lackerman commented 2 years ago

@satrox28 I tried it out and it worked without issue! Thank you so much!

I see the README card is not there yet. Do you need help on that one?