Skip to content

Commit

Permalink
DOP-4451 filling out initial TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
anabellabuckvar committed Apr 9, 2024
1 parent ce27d06 commit b14a005
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cdk-infra/lib/constructs/worker/worker-construct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
FargateService,
FargateTaskDefinition,
LogDrivers,
TaskDefinition,
} from 'aws-cdk-lib/aws-ecs';
import { Effect, IRole, PolicyStatement, Role, ServicePrincipal } from 'aws-cdk-lib/aws-iam';
import { LogGroup } from 'aws-cdk-lib/aws-logs';
Expand All @@ -23,6 +24,7 @@ interface WorkerConstructProps {
export class WorkerConstruct extends Construct {
readonly ecsTaskRole: IRole;
readonly clusterName: string;
readonly taskDefinition: TaskDefinition;

constructor(
scope: Construct,
Expand Down Expand Up @@ -112,6 +114,7 @@ export class WorkerConstruct extends Construct {
maxHealthyPercent: 200,
});

this.taskDefinition = taskDefinition;
this.clusterName = cluster.clusterName;
this.ecsTaskRole = taskRole;
}
Expand Down
6 changes: 6 additions & 0 deletions cdk-infra/lib/stacks/webhook-stack.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Stack, StackProps } from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { Vpc } from 'aws-cdk-lib/aws-ec2';
import { TaskDefinition } from 'aws-cdk-lib/aws-ecs';
import { AutoBuilderQueues } from './auto-builder-queue-stack';
import { WebhookApiConstruct } from '../constructs/api/webhook-api-construct';
import { WebhookEnvConstruct } from '../constructs/api/webhook-env-construct';
Expand All @@ -8,7 +10,11 @@ interface WebhookStackProps extends StackProps {
webhookSecureStrings: Record<string, string>;
queues: AutoBuilderQueues;
clusterName: string;
vpc: Vpc;
taskDefinition: TaskDefinition;
}

//TODO: use taskDefition and vpc somewhere here
export class WebhookStack extends Stack {
constructor(
scope: Construct,
Expand Down
5 changes: 4 additions & 1 deletion cdk-infra/lib/stacks/worker-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { WorkerConstruct } from '../constructs/worker/worker-construct';
import { WorkerEnvConstruct } from '../constructs/worker/worker-env-construct';
import { WorkerBucketsConstruct } from '../constructs/worker/buckets-construct';
import { AutoBuilderQueues } from './auto-builder-queue-stack';
import { TaskDefinition } from 'aws-cdk-lib/aws-ecs';
import { IVpc } from 'aws-cdk-lib/aws-ec2';

interface WorkerStackProps extends StackProps {
Expand All @@ -16,6 +17,7 @@ export class WorkerStack extends Stack {
// TODO: Create the task definition as properties here so
// that they are accessible to the webhook stack
public readonly clusterName: string;
public readonly taskDefinition: TaskDefinition;

constructor(scope: Construct, id: string, { queues, workerSecureStrings, vpc, ...props }: WorkerStackProps) {
super(scope, id, props);
Expand All @@ -27,7 +29,7 @@ export class WorkerStack extends Stack {

// TODO: retrieve the task definition from this stack as it is required
// for the RunTask in the smoke test build
const { clusterName, ecsTaskRole } = new WorkerConstruct(this, 'worker', {
const { clusterName, ecsTaskRole, taskDefinition } = new WorkerConstruct(this, 'worker', {
vpc,
dockerEnvironment: environment,
...queues,
Expand All @@ -40,6 +42,7 @@ export class WorkerStack extends Stack {

// TODO: Assign the task definition as properties here so
// that they are accessible to the webhook stack
this.taskDefinition = taskDefinition;
this.clusterName = clusterName;
}
}

0 comments on commit b14a005

Please sign in to comment.