Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cloud-infrastructure/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ module.exports = {
modulePathIgnorePatterns: ["cdk.out"],
testMatch: ["**/*.test.ts"],
transform: {
"^.+\\.tsx?$": "ts-jest"
}
"^.+\\.tsx?$": "ts-jest",
},
};
4 changes: 2 additions & 2 deletions eventbridge-consumer/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
testMatch: ["**/*.test.ts"],
transform: {
"^.+\\.tsx?$": "ts-jest"
}
"^.+\\.tsx?$": "ts-jest",
},
};
10 changes: 5 additions & 5 deletions eventbridge-consumer/lib/consumer.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Handler } from "aws-lambda";

export const handler: Handler = async event => {
export const handler: Handler = async (event) => {
try {
console.info(
JSON.stringify({
event: event,
level: "INFO",
message: "Processed event",
meta: {
service: "eventbridge-consumer"
}
service: "eventbridge-consumer",
},
})
);

Expand All @@ -22,9 +22,9 @@ export const handler: Handler = async event => {
level: "ERROR",
message: error.message,
meta: {
service: "eventbridge-consumer"
service: "eventbridge-consumer",
},
stack: error.stack
stack: error.stack,
})
);

Expand Down
4 changes: 2 additions & 2 deletions eventbridge-producer/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
testMatch: ["**/*.test.ts"],
transform: {
"^.+\\.tsx?$": "ts-jest"
}
"^.+\\.tsx?$": "ts-jest",
},
};
32 changes: 16 additions & 16 deletions eventbridge-producer/lib/producer.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {
PutEventsCommand,
EventBridgeClient
EventBridgeClient,
} from "@aws-sdk/client-eventbridge-node";
import {
APIGatewayProxyEvent,
APIGatewayProxyResult,
Handler
Handler,
} from "aws-lambda";
import cuid from "cuid";

const eventbridge = new EventBridgeClient({
region: "eu-west-2"
region: "eu-west-2",
});

export const handler: Handler = async (
Expand All @@ -25,13 +25,13 @@ export const handler: Handler = async (
{
Detail: JSON.stringify({
correlationID: cuid(),
status: body.status
status: body.status,
}),
DetailType: "AWS Lambda event",
Source: "com.ian",
Time: new Date()
}
]
Time: new Date(),
},
],
});

const putEvents = await eventbridge.send(putEventsCommand);
Expand All @@ -42,22 +42,22 @@ export const handler: Handler = async (
level: "INFO",
message: "Put event",
meta: {
service: "eventbridge-producer"
}
service: "eventbridge-producer",
},
})
);

return {
body: JSON.stringify({
entries: putEvents.Entries,
failedEntryCount: putEvents.FailedEntryCount
failedEntryCount: putEvents.FailedEntryCount,
}),
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "POST",
"Content-Type": "application/json"
"Content-Type": "application/json",
},
statusCode: 200
statusCode: 200,
};
} else {
throw new Error("Request body is empty");
Expand All @@ -70,9 +70,9 @@ export const handler: Handler = async (
level: "ERROR",
message: error.message,
meta: {
service: "eventbridge-producer"
service: "eventbridge-producer",
},
stack: error.stack
stack: error.stack,
})
);

Expand All @@ -81,9 +81,9 @@ export const handler: Handler = async (
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "POST",
"Content-Type": "application/json"
"Content-Type": "application/json",
},
statusCode: 500
statusCode: 500,
};
}
};
4 changes: 2 additions & 2 deletions eventbridge-s3/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
testMatch: ["**/*.test.ts"],
transform: {
"^.+\\.tsx?$": "ts-jest"
}
"^.+\\.tsx?$": "ts-jest",
},
};
2 changes: 1 addition & 1 deletion integration-pipeline/bin/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ new PipelineStack(app, `PipelineStack-${process.env.GITHUB_PR_NUMBER}`, {
eventbridgeProducerLambdaCode:
infrastructureStack.eventbridgeProducerLambdaCode,
eventbridgeS3LambdaCode: infrastructureStack.eventbridgeS3LambdaCode,
slackAlertingLambdaCode: infrastructureStack.slackAlertingLambdaCode
slackAlertingLambdaCode: infrastructureStack.slackAlertingLambdaCode,
});
4 changes: 2 additions & 2 deletions integration-pipeline/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ module.exports = {
modulePathIgnorePatterns: ["cdk.out"],
testMatch: ["**/*.test.ts"],
transform: {
"^.+\\.tsx?$": "ts-jest"
}
"^.+\\.tsx?$": "ts-jest",
},
};
104 changes: 52 additions & 52 deletions integration-pipeline/lib/__tests__/pipeline-stack.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,167 +25,167 @@ test("Stack has CodePipeline pipeline resource", () => {
ActionTypeId: {
Category: "Source",
Owner: "ThirdParty",
Provider: "GitHub"
Provider: "GitHub",
},
Configuration: {
Owner: "lukehedger",
Repo: "infra-as-node",
Branch: branch,
OAuthToken:
"{{resolve:secretsmanager:dev/Tread/GitHubToken:SecretString:::}}",
PollForSourceChanges: false
PollForSourceChanges: false,
},
Name: "GitHub_Source",
OutputArtifacts: [
{
Name: "Artifact_Source_GitHub_Source"
}
]
}
Name: "Artifact_Source_GitHub_Source",
},
],
},
],
Name: "Source"
Name: "Source",
},
{
Actions: [
{
ActionTypeId: {
Category: "Build",
Owner: "AWS",
Provider: "CodeBuild"
Provider: "CodeBuild",
},
InputArtifacts: [
{
Name: "Artifact_Source_GitHub_Source"
}
Name: "Artifact_Source_GitHub_Source",
},
],
Name: "Microservice_Build",
OutputArtifacts: [
{
Name: "InfrastructureBuildOutput"
Name: "InfrastructureBuildOutput",
},
{
Name: "ECLBO"
Name: "ECLBO",
},
{
Name: "EPLBO"
Name: "EPLBO",
},
{
Name: "ESLBO"
Name: "ESLBO",
},
{
Name: "SALBO"
}
]
Name: "SALBO",
},
],
},
{
ActionTypeId: {
Category: "Build",
Owner: "AWS",
Provider: "CodeBuild"
Provider: "CodeBuild",
},
InputArtifacts: [
{
Name: "Artifact_Source_GitHub_Source"
}
Name: "Artifact_Source_GitHub_Source",
},
],
Name: "StaticApp_Build",
OutputArtifacts: [
{
Name: "StaticAppBucket"
}
Name: "StaticAppBucket",
},
],
RunOrder: 1
}
RunOrder: 1,
},
],
Name: "Build"
Name: "Build",
},
{
Actions: [
{
ActionTypeId: {
Category: "Deploy",
Owner: "AWS",
Provider: "CloudFormation"
Provider: "CloudFormation",
},
Configuration: {
StackName: stackName,
Capabilities: "CAPABILITY_NAMED_IAM",
ParameterOverrides: "{}",
ActionMode: "CREATE_UPDATE",
TemplatePath: `InfrastructureBuildOutput::${stackName}.template.json`
TemplatePath: `InfrastructureBuildOutput::${stackName}.template.json`,
},
InputArtifacts: [
{
Name: "ECLBO"
Name: "ECLBO",
},
{
Name: "EPLBO"
Name: "EPLBO",
},
{
Name: "ESLBO"
Name: "ESLBO",
},
{
Name: "SALBO"
Name: "SALBO",
},
{
Name: "InfrastructureBuildOutput"
}
Name: "InfrastructureBuildOutput",
},
],
Name: "Infrastructure_Deploy",
RunOrder: 1
RunOrder: 1,
},
{
ActionTypeId: {
Category: "Deploy",
Owner: "AWS",
Provider: "S3"
Provider: "S3",
},
Configuration: {
BucketName: `static-app-${process.env.GITHUB_PR_NUMBER}`,
Extract: "true"
Extract: "true",
},
InputArtifacts: [
{
Name: "StaticAppBucket"
}
Name: "StaticAppBucket",
},
],
Name: "Static_App_Deploy",
RunOrder: 2
}
RunOrder: 2,
},
],
Name: "Deploy"
Name: "Deploy",
},
{
Actions: [
{
ActionTypeId: {
Category: "Test",
Owner: "AWS",
Provider: "CodeBuild"
Provider: "CodeBuild",
},
InputArtifacts: [
{
Name: "Artifact_Source_GitHub_Source"
}
Name: "Artifact_Source_GitHub_Source",
},
],
Name: "Workspace_Integration_Test"
}
Name: "Workspace_Integration_Test",
},
],
Name: "Test"
}
Name: "Test",
},
],
ArtifactStore: {
Type: "S3"
Type: "S3",
},
Name: `DeploymentPipeline-Integration-${process.env.GITHUB_PR_NUMBER}`
Name: `DeploymentPipeline-Integration-${process.env.GITHUB_PR_NUMBER}`,
});
});

test("Stack has CodePipeline GitHub webhook resource", () => {
expect(stack).toHaveResource("AWS::CodePipeline::Webhook", {
AuthenticationConfiguration: {
SecretToken:
"{{resolve:secretsmanager:dev/Tread/GitHubToken:SecretString:::}}"
}
"{{resolve:secretsmanager:dev/Tread/GitHubToken:SecretString:::}}",
},
});
});
Loading