Skip to content

Commit cd39599

Browse files
authored
Merge pull request #74 from adadouche/main
updated packages version & reverting versioned bucket and test cases
2 parents 7456153 + 8efcad5 commit cd39599

21 files changed

+6526
-6225
lines changed

.eslintignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 58 deletions
This file was deleted.

.github/workflows/test-cdk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010

1111
strategy:
1212
matrix:
13-
node-version: [16.x, 18.x, 20.x]
13+
node-version: [18.x, 20.x, 22.x]
1414

1515
steps:
1616
- name: Check out repository code

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,13 @@ The `cdk diff` command can be used to preview changes before deployment. This wi
4646
You can use [`npm link`](https://docs.npmjs.com/cli/v10/commands/npm-link) to develop with a local copy of this repo.
4747

4848
### In this library repo:
49+
4950
```bash
5051
npm install
5152
```
5253

5354
### In your-project folder:
55+
5456
```bash
5557
npm install
5658
npm link ../aws4embeddedlinux-ci
@@ -65,7 +67,6 @@ or [set a node prefix](https://docs.npmjs.com/resolving-eacces-permissions-error
6567
- When using AWS Cloud9 a micro instance type will run out of memory.
6668
- Deletion of stacks while a CodePipeline is running can lead to unexpected failures.
6769

68-
6970
## Security
7071

7172
See [SECURITY](SECURITY.md) for more information about reporting issues with this project.
@@ -79,10 +80,10 @@ source repos, etc.
7980
1. Grant access permissions to the CodeBuild pipeline project.
8081
11. Create a [Policy Statement](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.PolicyStatement.html) which allows `secretsmanager:GetSecretValue` for your secret.
8182
11. Add this policy statement to the `buildPolicyAdditions` props for the `EmbeddedLinuxPipelineStack`. e.g.
83+
8284
```typescript
8385
import * as iam from "aws-cdk-lib/aws-iam";
8486

85-
8687
const pipeline = new EmbeddedLinuxPipelineStack(app, "MyPokyPipeline", {
8788
imageRepo: buildImageRepo.repository,
8889
imageTag: ImageKind.Ubuntu22_04,
@@ -100,6 +101,7 @@ const pipeline = new EmbeddedLinuxPipelineStack(app, "MyPokyPipeline", {
100101

101102
The secret can then be used in the CodeBuild Project by adding it to the BuildSpec. See
102103
the [CodeBuild Documentation](https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html) for more details.
104+
103105
```yaml
104106
env:
105107
secrets-manager:

eslint.config.mjs

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import typescriptEslintEslintPlugin from "@typescript-eslint/eslint-plugin";
2+
import tsdoc from "eslint-plugin-tsdoc";
3+
import globals from "globals";
4+
import tsParser from "@typescript-eslint/parser";
5+
import path from "node:path";
6+
import { fileURLToPath } from "node:url";
7+
import js from "@eslint/js";
8+
import { FlatCompat } from "@eslint/eslintrc";
9+
10+
const __filename = fileURLToPath(import.meta.url);
11+
const __dirname = path.dirname(__filename);
12+
13+
import { includeIgnoreFile } from "@eslint/compat";
14+
const gitignorePath = path.resolve(__dirname, ".gitignore");
15+
16+
const compat = new FlatCompat({
17+
baseDirectory: __dirname,
18+
recommendedConfig: js.configs.recommended,
19+
allConfig: js.configs.all
20+
});
21+
22+
export default [...compat.extends(
23+
"eslint:recommended",
24+
"plugin:@typescript-eslint/recommended",
25+
"plugin:prettier/recommended",
26+
), {
27+
plugins: {
28+
"@typescript-eslint": typescriptEslintEslintPlugin,
29+
tsdoc,
30+
},
31+
32+
languageOptions: {
33+
globals: {
34+
...globals.browser,
35+
...globals.node,
36+
...globals.jest,
37+
},
38+
39+
parser: tsParser,
40+
ecmaVersion: "latest",
41+
sourceType: "module",
42+
43+
parserOptions: {
44+
sourceType: 'module',
45+
project: './tsconfig.json',
46+
},
47+
},
48+
49+
rules: {
50+
"tsdoc/syntax": "warn",
51+
52+
"max-len": ["error", {
53+
code: 150,
54+
ignoreUrls: true,
55+
ignoreStrings: true,
56+
ignoreTemplateLiterals: true,
57+
ignoreComments: true,
58+
ignoreRegExpLiterals: true,
59+
}],
60+
61+
"prettier/prettier": ["error", {
62+
singleQuote: true,
63+
trailingComma: "es5",
64+
}],
65+
},
66+
67+
ignores: [
68+
"jest.config.js",
69+
"package.json",
70+
"package-lock.json",
71+
"tsconfig.json",
72+
"typedoc.json",
73+
],
74+
},
75+
includeIgnoreFile(gitignorePath),
76+
{
77+
// your overrides
78+
},
79+
];

jest.config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
module.exports = {
2-
testEnvironment: 'node',
3-
roots: ['<rootDir>/test'],
4-
testMatch: ['**/*.test.ts'],
1+
export default {
2+
testEnvironment: "node",
3+
roots: ["<rootDir>/test"],
4+
testMatch: ["**/*.test.ts"],
55
transform: {
6-
'^.+\\.tsx?$': 'ts-jest',
6+
"^.+\\.tsx?$": "ts-jest",
77
},
88
};

lib/build-image-data.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class BuildImageDataStack extends cdk.Stack {
3737
*/
3838
private createDeploymentBucket(bucketName: string): s3.IBucket {
3939
const accessLoggingBucket = new s3.Bucket(this, 'LoggingBucket', {
40-
versioned: false,
40+
versioned: true,
4141
enforceSSL: true,
4242
autoDeleteObjects: true,
4343
removalPolicy: RemovalPolicy.DESTROY,
@@ -51,7 +51,7 @@ export class BuildImageDataStack extends cdk.Stack {
5151
// Create a bucket, then allow a deployment Lambda to upload to it.
5252
const dataBucket = new s3.Bucket(this, 'BuildImageDataBucket', {
5353
bucketName,
54-
versioned: false,
54+
versioned: true,
5555
encryptionKey: encryptionKey,
5656
enforceSSL: true,
5757
serverAccessLogsBucket: accessLoggingBucket,

lib/build-image-pipeline.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export interface BuildImagePipelineProps extends cdk.StackProps {
3535
readonly serverAccessLogsPrefix?: string;
3636
/** Artifact bucket to use */
3737
readonly artifactBucket?: s3.Bucket;
38-
3938
}
4039

4140
/**
@@ -107,11 +106,11 @@ export class BuildImagePipelineStack extends cdk.Stack {
107106

108107
let accessLoggingBucket: s3.IBucket;
109108

110-
if (props.accessLoggingBucket){
109+
if (props.accessLoggingBucket) {
111110
accessLoggingBucket = props.accessLoggingBucket;
112111
} else {
113-
accessLoggingBucket = new s3.Bucket(this, 'ArtifactAccessLogging', {
114-
versioned: false,
112+
accessLoggingBucket = new s3.Bucket(this, 'ArtifactAccessLogging', {
113+
versioned: true,
115114
enforceSSL: true,
116115
autoDeleteObjects: true,
117116
removalPolicy: RemovalPolicy.DESTROY,
@@ -120,15 +119,15 @@ export class BuildImagePipelineStack extends cdk.Stack {
120119

121120
let artifactBucket: s3.IBucket;
122121

123-
if (props.artifactBucket){
122+
if (props.artifactBucket) {
124123
artifactBucket = props.artifactBucket;
125124
} else {
126125
const encryptionKey = new kms.Key(this, 'PipelineArtifactKey', {
127-
removalPolicy: RemovalPolicy.DESTROY,
128-
enableKeyRotation: true,
129-
});
126+
removalPolicy: RemovalPolicy.DESTROY,
127+
enableKeyRotation: true,
128+
});
130129
artifactBucket = new s3.Bucket(this, 'PipelineArtifacts', {
131-
versioned: false,
130+
versioned: true,
132131
enforceSSL: true,
133132
serverAccessLogsBucket: accessLoggingBucket,
134133
serverAccessLogsPrefix: props.serverAccessLogsPrefix,

0 commit comments

Comments
 (0)