Skip to content

Commit

Permalink
nit for corey
Browse files Browse the repository at this point in the history
  • Loading branch information
ford-at-aws committed Oct 9, 2024
1 parent c8dda8a commit 45f4d00
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
16 changes: 4 additions & 12 deletions .tools/test/stacks/plugin/typescript/plugin_stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import * as subs from "aws-cdk-lib/aws-sns-subscriptions";
import { Construct } from "constructs";
import { readAccountConfig } from "../../config/targets";
import { readResourceConfig } from "../../config/resources";
import * as fs from 'fs';

import variableConfigJson from "../../config/variables.json";

const toolName = process.env.TOOL_NAME ?? "defaultToolName";

Expand All @@ -29,8 +28,6 @@ class PluginStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);

const variableConfigJson = JSON.parse(fs.readFileSync('../../config/variables.json', 'utf-8'));

const acctConfig = readAccountConfig("../../config/targets.yaml");
const resourceConfig = readResourceConfig("../../config/resources.yaml");

Expand All @@ -47,7 +44,7 @@ class PluginStack extends cdk.Stack {
this.batchVcpus = acctConfig[`${toolName}`]?.vcpus ?? "4";
}

const [jobDefinition, jobQueue] = this.initBatchFargate(variableConfigJson);
const [jobDefinition, jobQueue] = this.initBatchFargate();
const batchFunction = this.initBatchLambda(jobQueue, jobDefinition);
this.initSqsLambdaIntegration(batchFunction, sqsQueue);

Expand All @@ -65,7 +62,7 @@ class PluginStack extends cdk.Stack {
);
}

private initBatchFargate(variables: Array<string, string>): [batch.CfnJobDefinition, batch.CfnJobQueue] {
private initBatchFargate(): [batch.CfnJobDefinition, batch.CfnJobQueue] {
const batchExecutionRole = new iam.Role(
this,
`BatchExecutionRole-${toolName}`,
Expand Down Expand Up @@ -121,11 +118,6 @@ class PluginStack extends cdk.Stack {

const containerImageUri = `${this.adminAccountId}.dkr.ecr.us-east-1.amazonaws.com/${toolName}:latest`;

const environmentVariables = Object.entries(variables).map(([key, value]) => ({
name: key,
value: String(value), // Ensure value is a string
}));

const jobDefinition = new batch.CfnJobDefinition(this, "JobDefn", {
type: "container",
containerProperties: {
Expand All @@ -145,7 +137,7 @@ class PluginStack extends cdk.Stack {
value: this.batchMemory,
},
],
environment: environmentVariables,
environment: variableConfigJson,
},
platformCapabilities: ["FARGATE"],
});
Expand Down
4 changes: 3 additions & 1 deletion .tools/test/stacks/plugin/typescript/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"inlineSources": true,
"experimentalDecorators": true,
"strictPropertyInitialization": false,
"typeRoots": ["./node_modules/@types"]
"typeRoots": ["./node_modules/@types"],
"resolveJsonModule": true,
"esModuleInterop": true
},
"exclude": ["node_modules", "cdk.out"]
}

0 comments on commit 45f4d00

Please sign in to comment.