Skip to content

Commit

Permalink
Merge branch 'RoadieHQ:main' into chore/moment-to-luxon
Browse files Browse the repository at this point in the history
  • Loading branch information
GabDug authored Dec 20, 2024
2 parents 653202d + ac45577 commit a29492f
Show file tree
Hide file tree
Showing 20 changed files with 1,486 additions and 11 deletions.
9 changes: 9 additions & 0 deletions packages/backend/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# backend

## 2.3.2

### Patch Changes

- Updated dependencies [30883b0]
- Updated dependencies [2bf0fa2]
- @roadiehq/catalog-backend-module-aws@5.4.1
- @roadiehq/backstage-plugin-argo-cd-backend@3.3.1

## 2.3.1

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "backend",
"version": "2.3.1",
"version": "2.3.2",
"main": "dist/index.cjs.js",
"types": "src/index.ts",
"private": true,
Expand Down Expand Up @@ -41,11 +41,11 @@
"@langchain/core": "^0.2.27",
"@langchain/openai": "^0.2.7",
"@octokit/rest": "^19.0.3",
"@roadiehq/backstage-plugin-argo-cd-backend": "3.3.0",
"@roadiehq/backstage-plugin-argo-cd-backend": "3.3.1",
"@roadiehq/plugin-wiz-backend": "^1.0.7",
"@roadiehq/backstage-plugin-aws-auth": "^0.5.0",
"@roadiehq/backstage-plugin-aws-backend": "^1.3.0",
"@roadiehq/catalog-backend-module-aws": "^5.3.0",
"@roadiehq/catalog-backend-module-aws": "^5.4.1",
"@roadiehq/catalog-backend-module-okta": "^1.0.3",
"@roadiehq/rag-ai-backend": "^1.3.0",
"@roadiehq/rag-ai-backend-embeddings-aws": "^1.0.0",
Expand Down
15 changes: 15 additions & 0 deletions packages/backend/src/plugins/catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ import {
AWSRDSProvider,
AWSOrganizationAccountsProvider,
AWSSNSTopicProvider,
AWSSQSEntityProvider,
AWSOpenSearchEntityProvider,
AWSElastiCacheEntityProvider,
} from '@roadiehq/catalog-backend-module-aws';
import { OktaOrgEntityProvider } from '@roadiehq/catalog-backend-module-okta';
import { Duration } from 'luxon';
Expand Down Expand Up @@ -72,6 +75,12 @@ export default async function createPlugin(
const eksClusterProvider = AWSEKSClusterProvider.fromConfig(config, env);
const ec2Provider = AWSEC2Provider.fromConfig(config, env);
const rdsProvider = AWSRDSProvider.fromConfig(config, env);
const sqsProvider = AWSSQSEntityProvider.fromConfig(config, env);
const openSearchProvider = AWSOpenSearchEntityProvider.fromConfig(
config,
env,
);
const redisProvider = AWSElastiCacheEntityProvider.fromConfig(config, env);
const awsAccountsProvider = AWSOrganizationAccountsProvider.fromConfig(
config,
env,
Expand All @@ -86,6 +95,9 @@ export default async function createPlugin(
builder.addEntityProvider(eksClusterProvider);
builder.addEntityProvider(ec2Provider);
builder.addEntityProvider(rdsProvider);
builder.addEntityProvider(sqsProvider);
builder.addEntityProvider(openSearchProvider);
builder.addEntityProvider(redisProvider);
builder.addEntityProvider(awsAccountsProvider);
providers.push(s3Provider);
providers.push(lambdaProvider);
Expand All @@ -96,6 +108,9 @@ export default async function createPlugin(
providers.push(eksClusterProvider);
providers.push(ec2Provider);
providers.push(rdsProvider);
providers.push(sqsProvider);
providers.push(openSearchProvider);
providers.push(redisProvider);
providers.push(awsAccountsProvider);

const useDdbData = config.has('dynamodbTableData');
Expand Down
6 changes: 6 additions & 0 deletions plugins/backend/backstage-plugin-argo-cd-backend/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @roadiehq/backstage-plugin-argo-cd-backend

## 3.3.1

### Patch Changes

- 2bf0fa2: Adding the `resources-finalizer.argocd.argoproj.io` finalizer when creating a project. This allows the ability to delete the project first without getting stuck when deleting the application afterwards. This fix will allow the application to delete and not get stuck deleting.

## 3.3.0

### Minor Changes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@roadiehq/backstage-plugin-argo-cd-backend",
"version": "3.3.0",
"version": "3.3.1",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ export class ArgoService implements ArgoServiceApi {
metadata: {
name: projectName,
resourceVersion,
finalizers: ['resources-finalizer.argocd.argoproj.io'],
},
spec: {
destinations: [
Expand Down Expand Up @@ -350,6 +351,7 @@ export class ArgoService implements ArgoServiceApi {
},
body: JSON.stringify(data),
};

const resp = await fetch(`${baseUrl}/api/v1/projects`, options);
const responseData = await resp.json();
if (resp.status === 403) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,39 @@ describe('ArgoCD service', () => {
},
});
});

it('creates project with resources-finalizer.argocd.argoproj.io finalizer', async () => {
fetchMock.mockResponseOnce(
JSON.stringify({
argocdCreateProjectResp,
}),
);
const service = new ArgoService(
'testusername',
'testpassword',
getConfig({
token: 'token',
}),
loggerMock,
);

await service.createArgoProject({
baseUrl: 'baseUrl',
argoToken: 'token',
projectName: 'projectName',
namespace: 'namespace',
sourceRepo: 'sourceRepo',
});

expect(fetchMock).toHaveBeenCalledWith(
expect.any(String),
expect.objectContaining({
body: expect.stringContaining(
'{"metadata":{"name":"projectName","finalizers":["resources-finalizer.argocd.argoproj.io"]}',
),
}),
);
});
});

describe('createArgoApplication', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ export type Metadata = {
deletionTimestamp?: string;
deletionGracePeriodSeconds?: number;
resourceVersion?: string;
finalizers?: string[];
};

export type ResourceItem = {
Expand Down
24 changes: 24 additions & 0 deletions plugins/backend/catalog-backend-module-aws/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# @backstage/plugin-catalog-backend-module-aws

## 5.4.3

### Patch Changes

- 8fdf8c1: Use region from config in dynamo table provider

## 5.4.2

### Patch Changes

- 7a10368: Add more providers to allow custom label mapping

## 5.4.1

### Patch Changes

- 30883b0: Allow custom label mapping for new AWS providers

## 5.4.0

### Minor Changes

- 4bf2752: Add SQS, Redis and OpenSearch providers

## 5.3.1

### Patch Changes
Expand Down
13 changes: 8 additions & 5 deletions plugins/backend/catalog-backend-module-aws/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@roadiehq/catalog-backend-module-aws",
"description": "A set of Backstage catalog providers for AWS",
"version": "5.3.1",
"version": "5.4.3",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
Expand Down Expand Up @@ -43,27 +43,30 @@
"@aws-sdk/client-dynamodb": "^3.696.0",
"@aws-sdk/client-ec2": "^3.696.0",
"@aws-sdk/client-eks": "^3.696.0",
"@aws-sdk/client-elasticache": "^3.696.0",
"@aws-sdk/client-iam": "^3.696.0",
"@aws-sdk/client-lambda": "^3.696.0",
"@aws-sdk/client-opensearch": "^3.696.0",
"@aws-sdk/client-organizations": "^3.696.0",
"@aws-sdk/client-rds": "^3.696.0",
"@aws-sdk/client-s3": "^3.696.0",
"@aws-sdk/client-sts": "^3.696.0",
"@aws-sdk/client-sns": "^3.696.0",
"@aws-sdk/client-sqs": "^3.696.0",
"@aws-sdk/client-sts": "^3.696.0",
"@aws-sdk/credential-providers": "^3.696.0",
"@aws-sdk/lib-dynamodb": "^3.696.0",
"@backstage/integration-aws-node": "^0.1.13",
"@aws-sdk/util-arn-parser": "^3.76.0",
"@backstage/backend-common": "^0.25.0",
"@backstage/backend-plugin-api": "^1.0.1",
"@backstage/catalog-client": "^1.8.0",
"@backstage/plugin-kubernetes-common": "^0.9.0",
"@backstage/catalog-model": "^1.7.1",
"@backstage/config": "^1.3.0",
"@backstage/errors": "^1.2.5",
"@backstage/integration-aws-node": "^0.1.13",
"@backstage/plugin-catalog-backend": "^1.28.0",
"@backstage/plugin-catalog-node": "^1.14.0",
"@backstage/plugin-kubernetes-common": "^0.9.0",
"@backstage/types": "^1.2.0",
"@aws-sdk/util-arn-parser": "^3.76.0",
"link2aws": "^1.0.18",
"lodash": "^4.17.21",
"p-limit": "^3.0.2",
Expand Down
5 changes: 5 additions & 0 deletions plugins/backend/catalog-backend-module-aws/src/annotations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ export const ANNOTATION_AWS_S3_BUCKET_ARN = 'amazon.com/s3-bucket-arn';
export const ANNOTATION_AWS_EC2_INSTANCE_ID = 'amazon.com/ec2-instance-id';
export const ANNOTATION_AWS_RDS_INSTANCE_ARN = 'amazon.com/rds-instance-arn';
export const ANNOTATION_AWS_DDB_TABLE_ARN = 'amazon.com/dynamo-db-table-arn';
export const ANNOTATION_AWS_OPEN_SEARCH_ARN =
'amazon.com/open-search-domain-arn';
export const ANNOTATION_AWS_ELASTICACHE_CLUSTER_ARN =
'amazon.com/elasticache-cluster-arn';
export const ANNOTATION_AWS_SQS_QUEUE_ARN = 'amazon.com/sqs-queue-arn';
export const ANNOTATION_AWS_EKS_CLUSTER_ARN = 'amazon.com/eks-cluster-arn';
export const ANNOTATION_AWS_EKS_CLUSTER_VERSION =
'amazon.com/eks-cluster-version';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,12 @@ export class AWSDynamoDbTableProvider extends AWSEntityProvider {
}

private async getDdb(dynamicAccountConfig?: DynamicAccountConfig) {
const { region } = this.getParsedConfig(dynamicAccountConfig);
const credentials = this.useTemporaryCredentials
? this.getCredentials(dynamicAccountConfig)
: await this.getCredentialsProvider();
return this.useTemporaryCredentials
? new DynamoDB({ credentials })
? new DynamoDB({ credentials, region })
: new DynamoDB(credentials);
}

Expand Down
Loading

0 comments on commit a29492f

Please sign in to comment.