roadie-backstage-plugins
roadie-backstage-plugins copied to clipboard
Migrate plugins to new Backstage Backend system
The new backstage backend system is ready to be used at this point. The old backend system will be deprecated and is scheduled to be removed at the end of this year. As such this repo needs its backend plugins migrated to use the new Backstage Backend system.
If you would like to take ownership of migrating a plugin in this repo please, write a comment on this issue expressing your interest in helping out. Then create a pull request referencing this issue.
Here is an example of the pull request for the rag-ai-backend plugin https://github.com/RoadieHQ/roadie-backstage-plugins/pull/1319
- [ ] backstage-aws-backend
- [x] backstage-plugin-argo-cd-backend
- [ ] backstage-plugin-aws-auth
- [ ] catalog-backend-module-aws
- [x] catalog-backend-module-okta
- [ ] rag-ai-backend-embeddings-aws - not sure if this one is a backend plugin or not
- [ ] rag-ai-backend-embeddings-openai - not sure if this one is a backend plugin or not
- [ ] rag-ai-backend-retrieval-augmenter - not sure if this one is a backend plugin or not
- [x] rag-ai-backend
- [ ] rag-ai-node - not sure if this one is a backend plugin or not
- [ ] rag-ai-storage-pgvector - not sure if this one is a backend plugin or not
- [ ] scaffolder-backend-argocd
- [ ] scaffolder-backend-module-aws
- [x] scaffolder-backend-module-http-request
- [x] scaffolder-backend-module-utils
@drodil here is the issue we discussed.
I have interest on updating scoffolder-backend-module-http-request and scaffolder-backend-module-utils. I will share the PR once the work is complete.
Opened #1341
#1348, #1349 , and #1361 complete the migration of scoffolder-backend-module-http-request and scaffolder-backend-module-utils.
@kissmikijr @vanessap-aa could you advice if there is a way to use argocd backend plugin with the new backstage backend system? or do you have any migration plans? I attempted to manage it to work but without any success and at the same time I have a very little js/ts coding experience :)
Is it possible to re-open #1341 and get a review?
@kissmikijr @vanessap-aa could you advice if there is a way to use argocd backend plugin with the new backstage backend system? or do you have any migration plans? I attempted to manage it to work but without any success and at the same time I have a very little js/ts coding experience :)
I think you should be able to use the legacyPlugin
and register not migrated plugins yet to your backstage if you already use the new backend-system. I did not test it yet but something like this:
import { legacyPlugin } from '@backstage/backend-common';
backend.add(legacyPlugin('argoCd', import('./plugins/argocd')));
@kissmikijr @vanessap-aa could you advice if there is a way to use argocd backend plugin with the new backstage backend system? or do you have any migration plans? I attempted to manage it to work but without any success and at the same time I have a very little js/ts coding experience :)
I think you should be able to use the
legacyPlugin
and register not migrated plugins yet to your backstage if you already use the new backend-system. I did not test it yet but something like this:import { legacyPlugin } from '@backstage/backend-common'; backend.add(legacyPlugin('argoCd', import('./plugins/argocd')));
@kissmikijr First of all thanks for the reply.
I tried that way, unfortunately it doesn't work.
In the beginning when it failed there was PluginEnvironment
entity dependency from types.ts file, so I tried to bring back that file,
import { createRouter } from '@roadiehq/backstage-plugin-argo-cd-backend';
import { PluginEnvironment } from '../types';
export default async function createPlugin({
logger,
config,
}: PluginEnvironment) {
return await createRouter({ logger, config });
}
it didn't work, then I tried to remove that entity completely, so it doesn't depend on PluginEnvironment
and just import the plugin, it still didn't work
tried like this:
backend.add(legacyPlugin('argocd', import('@roadiehq/backstage-plugin-argo-cd-backend')));
it gave me some incompatibilities at the compile time.
#8 18.22 packages/backend/src/index.ts:60:36 - error TS2345: Argument of type 'Promise<{ default: typeof import("/backstage/node_modules/@roadiehq/backstage-plugin-argo-cd-backend/dist/index"); ArgoService: typeof ArgoService; createRouter: ({ logger, config, }: RouterOptions) => Promise<...>; }>' is not assignable to parameter of type 'Promise<{ default: LegacyCreateRouter<TransformedEnv<{ cache: CacheService; config: RootConfigService; database: DatabaseService; discovery: DiscoveryService; ... 5 more ...; identity: IdentityService; }, { ...; }>>; }>'.
#8 18.22 Type '{ default: typeof import("/backstage/node_modules/@roadiehq/backstage-plugin-argo-cd-backend/dist/index"); ArgoService: typeof ArgoService; createRouter: ({ logger, config, }: RouterOptions) => Promise<...>; }' is not assignable to type '{ default: LegacyCreateRouter<TransformedEnv<{ cache: CacheService; config: RootConfigService; database: DatabaseService; discovery: DiscoveryService; ... 5 more ...; identity: IdentityService; }, { ...; }>>; }'.
#8 18.22 Types of property 'default' are incompatible.
#8 18.22 Type 'typeof import("/backstage/node_modules/@roadiehq/backstage-plugin-argo-cd-backend/dist/index")' is not assignable to type 'LegacyCreateRouter<TransformedEnv<{ cache: CacheService; config: RootConfigService; database: DatabaseService; discovery: DiscoveryService; ... 5 more ...; identity: IdentityService; }, { ...; }>>'.
#8 18.22 Type 'typeof import("/backstage/node_modules/@roadiehq/backstage-plugin-argo-cd-backend/dist/index")' provides no match for the signature '(deps: TransformedEnv<{ cache: CacheService; config: RootConfigService; database: DatabaseService; discovery: DiscoveryService; ... 5 more ...; identity: IdentityService; }, { ...; }>): Promise<...>'.
#8 18.22
Hey @supersol
I got the backend plugin working with this:
// backend/src/plugins/argocd.ts
import { createRouter } from '@roadiehq/backstage-plugin-argo-cd-backend';
import { PluginEnvironment } from '../types';
import {Router} from "express";
export default async function createPlugin(
env: PluginEnvironment,
): Promise<Router> {
return await createRouter({
logger: env.logger,
config: env.config,
});
}
// backend/src/index.ts
+import {legacyPlugin} from '@backstage/backend-common';
...
+backend.add(legacyPlugin('argocd', import('./plugins/argocd')));
If you have a custom environment for your plugins you will need to use the following way to provide the custom environment to your plugins
An example custom env config.
// backend/src/index.ts
import { coreServices } from '@backstage/backend-plugin-api';
import {
makeLegacyPlugin,
loggerToWinstonLogger,
cacheToPluginCacheManager,
} from '@backstage/backend-common';
...
const legacyPlugin = makeLegacyPlugin(
{
logger: coreServices.logger,
cache: coreServices.cache,
database: coreServices.database,
auth: coreServices.auth,
config: coreServices.config,
reader: coreServices.urlReader,
discovery: coreServices.discovery,
tokenManager: coreServices.tokenManager,
permissions: coreServices.permissions,
scheduler: coreServices.scheduler,
// ... and your own additions
},
{
logger: log => loggerToWinstonLogger(log),
cache: cache => cacheToPluginCacheManager(cache),
},
);
...
backend.add(legacyPlugin('argocd', import('./plugins/argocd')));
Hello @kissmikijr is it possible to get a review on #1341 ?
thanks @kissmikijr @martina-equinix for your replies.
After some time I managed to make it work with the new backend, in case it will help to someone, I'll leave it here.
I made some tricks which mime the behavior for the new backend, it also looks like a part of migration actually.
I added 2 files to the plugins
folder,
- argocd_index.ts (name could be any)
export { argocdPlugin as default } from './argocd';
- argocd.ts (name should match export) Basically I wrapped a router with the new function for the plugins
import { createRouter } from '@roadiehq/backstage-plugin-argo-cd-backend';
import { loggerToWinstonLogger } from '@backstage/backend-common';
import {
coreServices,
createBackendPlugin,
} from '@backstage/backend-plugin-api';
export const argocdPlugin = createBackendPlugin({
pluginId: 'argocd',
register(env) {
env.registerInit({
deps: {
logger: coreServices.logger,
config: coreServices.rootConfig,
reader: coreServices.urlReader,
discovery: coreServices.discovery,
auth: coreServices.auth,
tokenManager: coreServices.tokenManager,
httpRouter: coreServices.httpRouter,
},
async init({
logger,
config,
httpRouter,
}) {
httpRouter.use(
await createRouter({
logger: loggerToWinstonLogger(logger),
config,
}),
);
},
});
},
});
3 . index.ts - added this "custom plugin" ( add parameters should match then name from 1. step)
...
backend.add(import('./plugins/argocd_index'));
...
Then the build didn't fail and the argocd cards in the UI were showing apps state and some history.
Hello,
We're working on a port of the RAG-AI to backend system of Backstage v1.30.x which includes a lot of deprecated API removals.
We backend modules to remove the dependency on CreateLegacyPlugin
.
If you're interresed we can make PR once we update the doc ?
link to the repo: https://github.com/alithya-oss/backstage-plugins/tree/main/workspaces/rag-ai/plugins
Thanks @fjudith, a pull request would be very welcome for that yeah.