backstage / backstage

Backstage is an open framework for building developer portals
https://backstage.io/
Apache License 2.0
28.23k stars 6k forks source link

Golang template is not displaying in templates page. #8171

Closed parulagg-1199 closed 2 years ago

parulagg-1199 commented 2 years ago

While adding a new template in backstage it is not showing in the templates page.

Adding the loom -- https://www.loom.com/share/3f5c16dfab144d86a909f9baf4e07d20

Screenshot from 2021-11-20 10-16-36

Kindly, guide me through this

Crevil commented 2 years ago

It seems the processor is not registered?

No processor recognized the entity as valid, possibly caused by a foreign kind or apiversion type=plugin entity=template:default/golang-starter

Or maybe the template is not valid.

Can you post the template you are attempting to use in its whole?

There are more docs here around custom templates if you haven't seen: https://backstage.io/docs/features/software-templates/adding-templates

parulagg-1199 commented 2 years ago

I'm using the template used in this repository

Could you please tell what I'm doing wrong

Crevil commented 2 years ago

The template you link is deprecated it seems. It uses the old apiVersion backstage.io/v1alpha1. It should instead use backstage.io/v1beta2.

Check out the repo with examples of templates that are up to date: https://github.com/backstage/software-templates

parulagg-1199 commented 2 years ago

I'm trying to create golang template and the templates you shared have not contained golang template. Could you guide me on how to create golang template?

parulagg-1199 commented 2 years ago

Getting this error while creating golang template error log --> 2021-11-22T12:02:12.000Z Beginning step Register 2021-11-22T12:02:12.000Z info: Registering https://github.com/parulagg-1199/go-lang-test-boilerplate23/tree/master/catalog-info.yaml in the catalog {"timestamp":"2021-11-22T12:02:12.443Z"} 2021-11-22T12:02:12.000Z Error: {"error":{"name":"Error","message":"NotFoundError: Unable to read url, NotFoundError: https://github.com/parulagg-1199/go-lang-test-boilerplate23/tree/master/catalog-info.yaml could not be read as https://api.github.com/repos/parulagg-1199/go-lang-test-boilerplate23/contents/catalog-info.yaml?ref=master, 404 Not Found","level":"error","service":"backstage"},"request":{"method":"POST","url":"/locations?dryRun=true"},"response":{"statusCode":500}} at CatalogClient.addLocation (/home/xs119-paragg/backstage-demo-local/node_modules/@backstage/catalog-client/dist/index.cjs.js:94:13) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Object.handler (/home/xs119-paragg/backstage-demo-local/node_modules/@backstage/plugin-scaffolder-backend/dist/index.cjs.js:146:24) at async HandlebarsWorkflowRunner.execute (/home/xs119-paragg/backstage-demo-local/node_modules/@backstage/plugin-scaffolder-backend/dist/index.cjs.js:2178:11) at async TaskWorker.runOneTask (/home/xs119-paragg/backstage-demo-local/node_modules/@backstage/plugin-scaffolder-backend/dist/index.cjs.js:2433:143) at async /home/xs119-paragg/backstage-demo-local/node_modules/@backstage/plugin-scaffolder-backend/dist/index.cjs.js:2427:9

using this template --> https://github.com/parulagg-1199/golang-boilerplate-test/blob/main/template.yaml
Crevil commented 2 years ago

I cannot access https://github.com/parulagg-1199/go-lang-test-boilerplate23/tree/master/catalog-info.yaml as well so I'm guessing it is a private repo and if such you need to make sure Backstage has the appropriate credentials to access it :)

Crevil commented 2 years ago

I cannot guide you to more than the linked resources as templates are very use case. You can try to port the Go template you used in the beginning to the new format however.

freben commented 2 years ago

The tricky thing with the golang template is that it used a significant post_gen_project.py, and we are shifting our examples over to using the new nunjucks based fetch:template action. That one does not, for security reasons, support running arbitrary hook code.

There is a package @backstage/plugin-scaffolder-backend-module-cookiecutter that has a fetch:cookiecutter action that you can use, if you decide to make a template of your own, or if you would like to contribute a pull request that migrates the existing template to the new apiVersion: backstage.io/v1beta3.

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.