Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various updates #73

Merged
merged 10 commits into from
Nov 27, 2024
Merged
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
10 changes: 6 additions & 4 deletions lib/build-image-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ export class BuildImageDataStack extends cdk.Stack {
*/
private createDeploymentBucket(bucketName: string): s3.IBucket {
const accessLoggingBucket = new s3.Bucket(this, 'LoggingBucket', {
versioned: true,
versioned: false,
enforceSSL: true,
autoDeleteObjects: true,
removalPolicy: RemovalPolicy.DESTROY,
});

const encryptionKey = new kms.Key(this, 'PipelineArtifactKey', {
Expand All @@ -49,12 +51,12 @@ export class BuildImageDataStack extends cdk.Stack {
// Create a bucket, then allow a deployment Lambda to upload to it.
const dataBucket = new s3.Bucket(this, 'BuildImageDataBucket', {
bucketName,
versioned: true,
versioned: false,
encryptionKey: encryptionKey,
removalPolicy: cdk.RemovalPolicy.DESTROY,
autoDeleteObjects: true,
enforceSSL: true,
serverAccessLogsBucket: accessLoggingBucket,
autoDeleteObjects: true,
removalPolicy: RemovalPolicy.DESTROY,
});

const cwPolicy = new iam.PolicyDocument({
Expand Down
9 changes: 7 additions & 2 deletions lib/build-image-pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ export class BuildImagePipelineStack extends cdk.Stack {
accessLoggingBucket = props.accessLoggingBucket;
} else {
accessLoggingBucket = new s3.Bucket(this, 'ArtifactAccessLogging', {
versioned: true,
versioned: false,
enforceSSL: true,
autoDeleteObjects: true,
removalPolicy: RemovalPolicy.DESTROY,
});
}

Expand All @@ -126,7 +128,7 @@ export class BuildImagePipelineStack extends cdk.Stack {
enableKeyRotation: true,
});
artifactBucket = new s3.Bucket(this, 'PipelineArtifacts', {
versioned: true,
versioned: false,
enforceSSL: true,
serverAccessLogsBucket: accessLoggingBucket,
serverAccessLogsPrefix: props.serverAccessLogsPrefix,
Expand All @@ -135,12 +137,15 @@ export class BuildImagePipelineStack extends cdk.Stack {
blockPublicAccess: new s3.BlockPublicAccess(
s3.BlockPublicAccess.BLOCK_ALL
),
autoDeleteObjects: true,
removalPolicy: RemovalPolicy.DESTROY,
});
}

const pipeline = new codepipeline.Pipeline(this, 'BuildImagePipeline', {
artifactBucket,
pipelineName: `${props.imageKind}BuildImagePipeline`,
pipelineType: codepipeline.PipelineType.V1,
stages: [
{
stageName: 'Source',
Expand Down
4 changes: 3 additions & 1 deletion lib/embedded-linux-codebuild-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import * as lambda from "aws-cdk-lib/aws-lambda";
import * as iam from "aws-cdk-lib/aws-iam";
import * as efs from "aws-cdk-lib/aws-efs";
import * as kms from "aws-cdk-lib/aws-kms";

Check warning on line 8 in lib/embedded-linux-codebuild-project.ts

View workflow job for this annotation

GitHub Actions / Run-CDK-Tests (16.x)

'kms' is defined but never used

Check warning on line 8 in lib/embedded-linux-codebuild-project.ts

View workflow job for this annotation

GitHub Actions / Run-CDK-Tests (18.x)

'kms' is defined but never used

Check warning on line 8 in lib/embedded-linux-codebuild-project.ts

View workflow job for this annotation

GitHub Actions / Run-CDK-Tests (20.x)

'kms' is defined but never used
import * as s3 from "aws-cdk-lib/aws-s3";

import {
Expand All @@ -26,7 +26,7 @@
} from "aws-cdk-lib/aws-ec2";
import { ProjectKind } from "./constructs/source-repo";
import { VMImportBucket } from "./vm-import-bucket";
import { Asset } from "aws-cdk-lib/aws-s3-assets";

Check warning on line 29 in lib/embedded-linux-codebuild-project.ts

View workflow job for this annotation

GitHub Actions / Run-CDK-Tests (16.x)

'Asset' is defined but never used

Check warning on line 29 in lib/embedded-linux-codebuild-project.ts

View workflow job for this annotation

GitHub Actions / Run-CDK-Tests (18.x)

'Asset' is defined but never used

Check warning on line 29 in lib/embedded-linux-codebuild-project.ts

View workflow job for this annotation

GitHub Actions / Run-CDK-Tests (20.x)

'Asset' is defined but never used
import { LogGroup, RetentionDays } from "aws-cdk-lib/aws-logs";
import { RemovalPolicy } from "aws-cdk-lib";

Expand Down Expand Up @@ -93,9 +93,11 @@
if (props.accessLoggingBucket) {
accessLoggingBucket = props.accessLoggingBucket;
} else {
accessLoggingBucket = new s3.Bucket(this, "ArtifactAccessLogging", {

Check warning on line 96 in lib/embedded-linux-codebuild-project.ts

View workflow job for this annotation

GitHub Actions / Run-CDK-Tests (16.x)

'accessLoggingBucket' is assigned a value but never used

Check warning on line 96 in lib/embedded-linux-codebuild-project.ts

View workflow job for this annotation

GitHub Actions / Run-CDK-Tests (18.x)

'accessLoggingBucket' is assigned a value but never used

Check warning on line 96 in lib/embedded-linux-codebuild-project.ts

View workflow job for this annotation

GitHub Actions / Run-CDK-Tests (20.x)

'accessLoggingBucket' is assigned a value but never used
versioned: true,
versioned: false,
enforceSSL: true,
autoDeleteObjects: true,
removalPolicy: RemovalPolicy.DESTROY,
});
}

Expand Down
16 changes: 13 additions & 3 deletions lib/embedded-linux-pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@ export class EmbeddedLinuxPipelineStack extends cdk.Stack {
accessLoggingBucket = props.accessLoggingBucket;
} else {
accessLoggingBucket = new s3.Bucket(this, 'ArtifactAccessLogging', {
versioned: true,
versioned: false,
enforceSSL: true,
autoDeleteObjects: true,
removalPolicy: RemovalPolicy.DESTROY,
});
}

Expand All @@ -114,6 +116,7 @@ export class EmbeddedLinuxPipelineStack extends cdk.Stack {
enableKeyRotation: true,
}
);

if (props.outputBucket){
outputBucket = props.outputBucket;
} else {
Expand All @@ -124,6 +127,8 @@ export class EmbeddedLinuxPipelineStack extends cdk.Stack {
encryptionKeyArn: outputBucketEncryptionKey.keyArn,
serverAccessLogsBucket: accessLoggingBucket,
serverAccessLogsPrefix: props.serverAccessLogsPrefix,
autoDeleteObjects: true,
removalPolicy: RemovalPolicy.DESTROY,
});
}
environmentVariables = {
Expand All @@ -145,9 +150,11 @@ export class EmbeddedLinuxPipelineStack extends cdk.Stack {
outputBucket = props.outputBucket;
} else {
outputBucket = new s3.Bucket(this, 'PipelineOutput', {
versioned: true,
versioned: false,
enforceSSL: true,
serverAccessLogsBucket: accessLoggingBucket,
autoDeleteObjects: true,
removalPolicy: RemovalPolicy.DESTROY,
});
}
}
Expand All @@ -162,14 +169,16 @@ export class EmbeddedLinuxPipelineStack extends cdk.Stack {
enableKeyRotation: true,
});
artifactBucket = new s3.Bucket(this, 'PipelineArtifacts', {
versioned: true,
versioned: false,
enforceSSL: true,
serverAccessLogsBucket: accessLoggingBucket,
encryptionKey,
encryption: s3.BucketEncryption.KMS,
blockPublicAccess: new s3.BlockPublicAccess(
s3.BlockPublicAccess.BLOCK_ALL
),
autoDeleteObjects: true,
removalPolicy: RemovalPolicy.DESTROY,
});
}

Expand Down Expand Up @@ -335,6 +344,7 @@ def handler(event, context):
const pipeline = new codepipeline.Pipeline(this, 'EmbeddedLinuxPipeline', {
artifactBucket,
restartExecutionOnUpdate: true,
pipelineType: codepipeline.PipelineType.V1,
stages: [
{
stageName: 'Source',
Expand Down
5 changes: 2 additions & 3 deletions lib/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ import { LogGroup, RetentionDays } from 'aws-cdk-lib/aws-logs';
export class PipelineNetworkStack extends cdk.Stack {
/** The VPC for the pipeline to reside in. */
public readonly vpc: ec2.IVpc;

constructor(scope: Construct, props?: cdk.StackProps) {
super(scope, 'PipelineNetwork', props);
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);

// We will create a VPC with 3 Private and Public subnets for AWS
// Resources that have network interfaces (e.g. Connecting and EFS
Expand Down
Loading