Skip to content

Commit

Permalink
Merge pull request #1794 from RoadieHQ/Update-rag-ai-and-actions
Browse files Browse the repository at this point in the history
Update actions and update scaffolder packages
  • Loading branch information
Irma12 authored Jan 21, 2025
2 parents 7a1f97b + e9c26c6 commit 874453e
Show file tree
Hide file tree
Showing 45 changed files with 1,013 additions and 214 deletions.
14 changes: 14 additions & 0 deletions .changeset/shiny-fans-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
'@roadiehq/scaffolder-backend-module-http-request': minor
'@roadiehq/scaffolder-backend-module-utils': minor
'@roadiehq/scaffolder-backend-module-aws': minor
'@roadiehq/backstage-plugin-github-pull-requests': minor
'@roadiehq/scaffolder-backend-argocd': minor
'backend': minor
'@roadiehq/rag-ai-backend-retrieval-augmenter': patch
'@roadiehq/backstage-plugin-github-insights': patch
'@roadiehq/rag-ai-backend-embeddings-openai': patch
'@roadiehq/rag-ai-backend-embeddings-aws': patch
---

Update scaffolder packages, tidy up some imports
6 changes: 3 additions & 3 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
"@backstage/catalog-client": "^1.8.0",
"@backstage/catalog-model": "^1.7.1",
"@backstage/config": "^1.3.0",
"@backstage/integration": "^1.15.2",
"@backstage/integration": "^1.16.1",
"@backstage/integration-aws-node": "^0.1.13",
"@backstage/plugin-app-backend": "^0.4.2",
"@backstage/plugin-auth-backend": "^0.24.0",
"@backstage/plugin-catalog-backend": "^1.28.0",
"@backstage/plugin-permission-common": "^0.8.2",
"@backstage/plugin-permission-node": "^0.8.5",
"@backstage/plugin-proxy-backend": "^0.5.8",
"@backstage/plugin-scaffolder-backend": "^1.27.1",
"@backstage/plugin-scaffolder-node": "^0.6.0",
"@backstage/plugin-scaffolder-backend": "^1.28.0",
"@backstage/plugin-scaffolder-node": "^0.6.2",
"@backstage/plugin-techdocs-backend": "^1.11.3",
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "^0.2.2",
"@gitbeaker/node": "^35.1.0",
Expand Down
12 changes: 7 additions & 5 deletions plugins/backend/rag-ai-backend-embeddings-aws/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,27 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { TokenManager } from '@backstage/backend-common';
import { Logger } from 'winston';
import { AugmentationIndexer, RoadieVectorStore } from '@roadiehq/rag-ai-node';
import {
BedrockConfig,
RoadieBedrockAugmenter,
} from './RoadieBedrockAugmenter';
import { CatalogApi } from '@backstage/catalog-client';
import { PluginEndpointDiscovery } from '@backstage/backend-common';
import {
PluginEndpointDiscovery,
TokenManager,
} from '@backstage/backend-common';
import { AwsCredentialIdentity, Provider } from '@aws-sdk/types';
import { Config } from '@backstage/config';
import { AugmentationOptions } from '@roadiehq/rag-ai-backend-retrieval-augmenter';
import { LoggerService } from '@backstage/backend-plugin-api';

export interface RoadieBedrockEmbeddingsConfig {
logger: Logger | LoggerService;
tokenManager?: TokenManager;
vectorStore: RoadieVectorStore;
catalogApi: CatalogApi;
tokenManager?: TokenManager;
discovery: PluginEndpointDiscovery;
config: Config;
options: {
Expand All @@ -42,9 +44,9 @@ export interface RoadieBedrockEmbeddingsConfig {

export async function initializeBedrockEmbeddings({
logger,
tokenManager,
vectorStore,
catalogApi,
tokenManager,
discovery,
config,
options,
Expand All @@ -66,9 +68,9 @@ export async function initializeBedrockEmbeddings({
catalogApi,
discovery,
logger: logger.child({ label: 'roadie-bedrock-embedder' }),
tokenManager,
options,
bedrockConfig,
tokenManager,
augmentationOptions,
});
}
6 changes: 4 additions & 2 deletions plugins/backend/rag-ai-backend-embeddings-openai/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { TokenManager } from '@backstage/backend-common';
import { Logger } from 'winston';
import { LoggerService } from '@backstage/backend-plugin-api';
import { AugmentationIndexer, RoadieVectorStore } from '@roadiehq/rag-ai-node';
import { OpenAiConfig, RoadieOpenAiAugmenter } from './RoadieOpenAiAugmenter';
import { CatalogApi } from '@backstage/catalog-client';
import { PluginEndpointDiscovery } from '@backstage/backend-common';
import {
PluginEndpointDiscovery,
TokenManager,
} from '@backstage/backend-common';
import { Config } from '@backstage/config';
import { AugmentationOptions } from '@roadiehq/rag-ai-backend-retrieval-augmenter';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { TokenManager } from '@backstage/backend-common';
import { CatalogApi } from '@backstage/catalog-client';
import { LoggerService } from '@backstage/backend-plugin-api';
import { PluginEndpointDiscovery } from '@backstage/backend-common';
import {
PluginEndpointDiscovery,
TokenManager,
} from '@backstage/backend-common';
import { RoadieVectorStore } from '@roadiehq/rag-ai-node';
import { Entity } from '@backstage/catalog-model';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@backstage/catalog-model": "^1.7.1",
"@backstage/core-components": "^0.16.1",
"@backstage/core-plugin-api": "^1.10.1",
"@backstage/integration": "^1.15.2",
"@backstage/integration": "^1.16.1",
"@backstage/integration-react": "^1.2.1",
"@backstage/plugin-catalog-react": "^1.14.2",
"@backstage/theme": "^0.6.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@backstage/catalog-model": "^1.7.1",
"@backstage/core-components": "^0.16.1",
"@backstage/core-plugin-api": "^1.10.1",
"@backstage/integration": "^1.15.2",
"@backstage/integration": "^1.16.1",
"@backstage/integration-react": "^1.2.1",
"@backstage/plugin-catalog-react": "^1.14.2",
"@backstage/plugin-home-react": "^0.1.20",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@backstage/backend-common": "^0.25.0",
"@backstage/backend-plugin-api": "^1.0.2",
"@backstage/config": "^1.3.0",
"@backstage/plugin-scaffolder-node": "^0.6.0",
"@backstage/plugin-scaffolder-node": "^0.6.2",
"@roadiehq/backstage-plugin-argo-cd-backend": "^3.3.0",
"@backstage/backend-test-utils": "^1.1.0",
"winston": "^3.2.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ describe('argocd:create-resources', () => {
createTemporaryDirectory: jest.fn(),
checkpoint: jest.fn(),
getInitiatorCredentials: jest.fn(),
task: {
id: 'task-id',
getWorkspaceName: jest.fn(),
getWorkspacePath: jest.fn(),
getLogger: jest.fn(),
emitLog: jest.fn(),
getSecrets: jest.fn(),
getParameters: jest.fn(),
},
input: {
argoInstance: 'argoInstance1',
namespace: 'testNamespace',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,20 @@ import { createTemplateAction } from '@backstage/plugin-scaffolder-node';
import { ArgoService } from '@roadiehq/backstage-plugin-argo-cd-backend';
import { Logger } from 'winston';
import { LoggerService } from '@backstage/backend-plugin-api';
import { TemplateAction } from '@backstage/plugin-scaffolder-node';

export const createArgoCdResources = (
config: Config,
logger: Logger | LoggerService,
) => {
): TemplateAction<{
argoInstance: string;
namespace: string;
projectName?: string;
appName: string;
repoUrl: string;
path: string;
labelValue?: string;
}> => {
return createTemplateAction<{
argoInstance: string;
namespace: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@backstage/backend-plugin-api": "^1.0.2",
"@backstage/config": "^1.3.0",
"@backstage/errors": "^1.2.5",
"@backstage/plugin-scaffolder-node": "^0.6.0",
"@backstage/plugin-scaffolder-node": "^0.6.2",
"cross-fetch": "^3.1.4",
"fs-extra": "^10.0.0",
"glob": "^7.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { createEcrAction } from './create';
import { mockClient } from 'aws-sdk-client-mock';
import { ECRClient } from '@aws-sdk/client-ecr';
import { getVoidLogger } from '@backstage/backend-common';
import { TemplateAction } from '@backstage/plugin-scaffolder-node/index';

// @ts-ignore
const ecrClient = mockClient(ECRClient);
Expand All @@ -27,6 +28,9 @@ ecrClient.resolves({});

describe('create', () => {
const mockContext = {
task: {
id: 'task-id',
},
logger: getVoidLogger(),
logStream: new PassThrough(),
output: jest.fn(),
Expand All @@ -39,7 +43,7 @@ describe('create', () => {
describe('Create ECR repository without tags', () => {
const repoName = 'no-tags';

const action = createEcrAction();
const action: TemplateAction<any> = createEcrAction();

it('Should call ECR client send without tags', async () => {
await action.handler({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,21 @@ import {
} from '@aws-sdk/client-ecr';
import { CredentialProvider } from '@aws-sdk/types';
import { assertError } from '@backstage/errors';
import { TemplateAction } from '@backstage/plugin-scaffolder-node';

export function createEcrAction(options?: {
credentials?: CredentialProvider;
}) {
return createTemplateAction<{
}): TemplateAction<
{
repoName: string;
tags: Array<any>;
imageMutability: boolean;
scanOnPush: boolean;
region: string;
}>({
},
any
> {
return createTemplateAction({
id: 'roadiehq:aws:ecr:create',
schema: {
input: {
Expand All @@ -46,11 +50,7 @@ export function createEcrAction(options?: {
title: 'repoName',
description: 'The name of the ECR repository',
},
tags: {
type: 'array',
title: 'tags',
description: 'list of tags',
},
tags: { type: 'array', title: 'tags', description: 'list of tags' },
imageMutability: {
type: 'boolean',
title: 'ImageMutability',
Expand All @@ -59,13 +59,12 @@ export function createEcrAction(options?: {
scanOnPush: {
type: 'boolean',
title: 'Scan On Push',
description:
'The image scanning configuration for the repository. This determines whether images are scanned for known vulnerabilities after being pushed to the repository.',
description: 'Scan images for vulnerabilities on push',
},
region: {
type: 'string',
title: 'aws region',
description: 'aws region to create ECR on',
description: 'AWS region to create ECR in',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ jest.mock('fs-extra', () => {

describe('roadiehq:aws:s3:cp', () => {
const mockContext = {
task: {
id: 'task-id',
},
logger: getVoidLogger(),
logStream: new PassThrough(),
output: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,31 @@
* limitations under the License.
*/

import { createTemplateAction } from '@backstage/plugin-scaffolder-node';
import {
createTemplateAction,
TemplateAction,
} from '@backstage/plugin-scaffolder-node';
import { S3Client, PutObjectCommand, S3ClientConfig } from '@aws-sdk/client-s3';
import fs, { createReadStream } from 'fs-extra';
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
import glob from 'glob';
import { CredentialProvider } from '@aws-sdk/types';
import { assertError } from '@backstage/errors';
import { JsonObject } from '@backstage/config';

export function createAwsS3CpAction(options?: {
credentials?: CredentialProvider;
}) {
}): TemplateAction<
{
bucket: string;
region: string;
path?: string;
prefix?: string;
endpoint?: string;
s3ForcePathStyle?: boolean;
},
JsonObject
> {
return createTemplateAction<{
bucket: string;
region: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ const region = 'us-east-1';

describe('create', () => {
const mockContext = {
task: {
id: 'task-id',
},
logger: getVoidLogger(),
logStream: new PassThrough(),
output: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,35 @@
* limitations under the License.
*/

import { createTemplateAction } from '@backstage/plugin-scaffolder-node';
import {
createTemplateAction,
TemplateAction,
} from '@backstage/plugin-scaffolder-node';
import {
SecretsManagerClient,
SecretsManagerClientConfig,
CreateSecretCommand,
} from '@aws-sdk/client-secrets-manager';
import { CredentialProvider } from '@aws-sdk/types';
import { assertError } from '@backstage/errors';
import { JsonObject } from '@backstage/config/index';

export function createAwsSecretsManagerCreateAction(options?: {
credentials?: CredentialProvider;
}) {
}): TemplateAction<
{
name: string;
description: string;
value: string;
tags: Array<{
Key: string;
Value: string;
}>;
profile: string;
region: string;
},
JsonObject
> {
return createTemplateAction<{
name: string;
description: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@backstage/backend-plugin-api": "^1.0.2",
"@backstage/core-app-api": "^1.15.2",
"@backstage/core-plugin-api": "^1.10.1",
"@backstage/plugin-scaffolder-node": "^0.6.0",
"@backstage/plugin-scaffolder-node": "^0.6.2",
"cross-fetch": "^4.0.0",
"winston": "^3.2.1"
},
Expand Down
Loading

0 comments on commit 874453e

Please sign in to comment.