community-plugins icon indicating copy to clipboard operation
community-plugins copied to clipboard

🐛 Code-coverage: Calling new backend gives 404

Open AarjanM opened this issue 1 year ago • 6 comments

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

  1. Create a vanilla installation of new backstage architecture
  2. Follow the readme to add code-coverage plugin for backend and frontend
  3. Add annotation backstage.io/code-coverage: enabled to example-website in examples.yaml
  4. yarn dev
  5. curl -X POST -H "Content-Type:text/xml” -d @coberturea.xml "localhost:7007/api/code-coverage/report?entity=component:default/example-website&coverageType=cobertura"
  6. Returns 404
  7. 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?

Are you willing to submit PR?

No, but I'm happy to collaborate on a PR with someone else

AarjanM avatar Jun 19 '24 09:06 AarjanM

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?

awanlin avatar Jul 02 '24 14:07 awanlin

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

AarjanMeirink avatar Jul 09 '24 08:07 AarjanMeirink

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.

awanlin avatar Jul 09 '24 12:07 awanlin

Yeah, my suggestion would be to change the pluginId to 'code-coverage'

AarjanMeirink avatar Jul 09 '24 12:07 AarjanMeirink

Contributions welcome, updating the frontend is the recommended path as it would not cause a breaking change 👍

awanlin avatar Jul 16 '24 14:07 awanlin

Opened a PR ⬆️

brianwyka avatar Aug 16 '24 01:08 brianwyka

First PR closed and new one opened. ☝️

brianwyka avatar Sep 06 '24 19:09 brianwyka