đ Code-coverage: Calling new backend gives 404
Plugin Name
code-coverage
đ Description
When calling the backend of this plugin in the new backend architecture (curl localhost:7007/api/code-coverage/report?entity=component:default/entity-name), it returns a 404. I think this is caused because the pluginId ('codeCoverage') is the default for the router. Calling curl localhost:7007/api/codecoverage/report?entity=component:default/entity-name gives the expected result.
đ Expected behavior
return the code-coverage report of the entity
đ Actual Behavior with Screenshots
404 not found
đ Reproduction steps
- Create a vanilla installation of new backstage architecture
- Follow the readme to add code-coverage plugin for backend and frontend
- Add annotation backstage.io/code-coverage: enabled to example-website in examples.yaml
- yarn dev
- curl -X POST -H "Content-Type:text/xmlâ -d @coberturea.xml "localhost:7007/api/code-coverage/report?entity=component:default/example-website&coverageType=cobertura"
- Returns 404
- Open Backstage, navigate to example-website and code coverage tab --> Errors 404 not found messages
đ Provide the context for the Bug.
Can't use the code coverage plugin in our new Backstage installation
đ Have you spent some time to check if this bug has been raised before?
- [X] I checked and didn't find similar issue
đ˘ Have you read the Code of Conduct?
- [X] I have read the Code of Conduct
Are you willing to submit PR?
No, but I'm happy to collaborate on a PR with someone else
Hi @AarjanM, with the new backend system there is currently no way to change this value, it uses the pluginId. Would you be able to change this from the location that sends the data?
Hi @awanlin, the part sending the data I can change but I can't change the frontend plugin that calls the wrong url as well
Thanks for following up. So the backend code uses codeCoverage here:
https://github.com/backstage/community-plugins/blob/e781475e44f2e22be6fd085e6db6c307fdb71a13/workspaces/code-coverage/plugins/code-coverage-backend/src/plugin.ts#L28
The frontend code uses code-coverage here:
https://github.com/backstage/community-plugins/blob/e781475e44f2e22be6fd085e6db6c307fdb71a13/workspaces/code-coverage/plugins/code-coverage/src/api.ts#L62
As many may already be using code-coverage as the endpoint they use to submit coverage data it makes sense that we should use that everywhere.
Yeah, my suggestion would be to change the pluginId to 'code-coverage'
Contributions welcome, updating the frontend is the recommended path as it would not cause a breaking change đ
Opened a PR âŹď¸
First PR closed and new one opened. âď¸