Skip to content

Commit

Permalink
Merge pull request #74 from adadouche/main
Browse files Browse the repository at this point in the history
updated packages version & reverting versioned bucket and test cases
  • Loading branch information
thomas-roos authored Dec 13, 2024
2 parents 7456153 + 8efcad5 commit cd39599
Show file tree
Hide file tree
Showing 21 changed files with 6,526 additions and 6,225 deletions.
8 changes: 0 additions & 8 deletions .eslintignore

This file was deleted.

58 changes: 0 additions & 58 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/test-cdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x, 22.x]

steps:
- name: Check out repository code
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ The `cdk diff` command can be used to preview changes before deployment. This wi
You can use [`npm link`](https://docs.npmjs.com/cli/v10/commands/npm-link) to develop with a local copy of this repo.

### In this library repo:

```bash
npm install
```

### In your-project folder:

```bash
npm install
npm link ../aws4embeddedlinux-ci
Expand All @@ -65,7 +67,6 @@ or [set a node prefix](https://docs.npmjs.com/resolving-eacces-permissions-error
- When using AWS Cloud9 a micro instance type will run out of memory.
- Deletion of stacks while a CodePipeline is running can lead to unexpected failures.


## Security

See [SECURITY](SECURITY.md) for more information about reporting issues with this project.
Expand All @@ -79,10 +80,10 @@ source repos, etc.
1. Grant access permissions to the CodeBuild pipeline project.
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.
11. Add this policy statement to the `buildPolicyAdditions` props for the `EmbeddedLinuxPipelineStack`. e.g.

```typescript
import * as iam from "aws-cdk-lib/aws-iam";


const pipeline = new EmbeddedLinuxPipelineStack(app, "MyPokyPipeline", {
imageRepo: buildImageRepo.repository,
imageTag: ImageKind.Ubuntu22_04,
Expand All @@ -100,6 +101,7 @@ const pipeline = new EmbeddedLinuxPipelineStack(app, "MyPokyPipeline", {

The secret can then be used in the CodeBuild Project by adding it to the BuildSpec. See
the [CodeBuild Documentation](https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html) for more details.

```yaml
env:
secrets-manager:
Expand Down
79 changes: 79 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import typescriptEslintEslintPlugin from "@typescript-eslint/eslint-plugin";
import tsdoc from "eslint-plugin-tsdoc";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

import { includeIgnoreFile } from "@eslint/compat";
const gitignorePath = path.resolve(__dirname, ".gitignore");

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
), {
plugins: {
"@typescript-eslint": typescriptEslintEslintPlugin,
tsdoc,
},

languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.jest,
},

parser: tsParser,
ecmaVersion: "latest",
sourceType: "module",

parserOptions: {
sourceType: 'module',
project: './tsconfig.json',
},
},

rules: {
"tsdoc/syntax": "warn",

"max-len": ["error", {
code: 150,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreComments: true,
ignoreRegExpLiterals: true,
}],

"prettier/prettier": ["error", {
singleQuote: true,
trailingComma: "es5",
}],
},

ignores: [
"jest.config.js",
"package.json",
"package-lock.json",
"tsconfig.json",
"typedoc.json",
],
},
includeIgnoreFile(gitignorePath),
{
// your overrides
},
];
10 changes: 5 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module.exports = {
testEnvironment: 'node',
roots: ['<rootDir>/test'],
testMatch: ['**/*.test.ts'],
export default {
testEnvironment: "node",
roots: ["<rootDir>/test"],
testMatch: ["**/*.test.ts"],
transform: {
'^.+\\.tsx?$': 'ts-jest',
"^.+\\.tsx?$": "ts-jest",
},
};
4 changes: 2 additions & 2 deletions lib/build-image-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class BuildImageDataStack extends cdk.Stack {
*/
private createDeploymentBucket(bucketName: string): s3.IBucket {
const accessLoggingBucket = new s3.Bucket(this, 'LoggingBucket', {
versioned: false,
versioned: true,
enforceSSL: true,
autoDeleteObjects: true,
removalPolicy: RemovalPolicy.DESTROY,
Expand All @@ -51,7 +51,7 @@ 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: false,
versioned: true,
encryptionKey: encryptionKey,
enforceSSL: true,
serverAccessLogsBucket: accessLoggingBucket,
Expand Down
17 changes: 8 additions & 9 deletions lib/build-image-pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export interface BuildImagePipelineProps extends cdk.StackProps {
readonly serverAccessLogsPrefix?: string;
/** Artifact bucket to use */
readonly artifactBucket?: s3.Bucket;

}

/**
Expand Down Expand Up @@ -107,11 +106,11 @@ export class BuildImagePipelineStack extends cdk.Stack {

let accessLoggingBucket: s3.IBucket;

if (props.accessLoggingBucket){
if (props.accessLoggingBucket) {
accessLoggingBucket = props.accessLoggingBucket;
} else {
accessLoggingBucket = new s3.Bucket(this, 'ArtifactAccessLogging', {
versioned: false,
accessLoggingBucket = new s3.Bucket(this, 'ArtifactAccessLogging', {
versioned: true,
enforceSSL: true,
autoDeleteObjects: true,
removalPolicy: RemovalPolicy.DESTROY,
Expand All @@ -120,15 +119,15 @@ export class BuildImagePipelineStack extends cdk.Stack {

let artifactBucket: s3.IBucket;

if (props.artifactBucket){
if (props.artifactBucket) {
artifactBucket = props.artifactBucket;
} else {
const encryptionKey = new kms.Key(this, 'PipelineArtifactKey', {
removalPolicy: RemovalPolicy.DESTROY,
enableKeyRotation: true,
});
removalPolicy: RemovalPolicy.DESTROY,
enableKeyRotation: true,
});
artifactBucket = new s3.Bucket(this, 'PipelineArtifacts', {
versioned: false,
versioned: true,
enforceSSL: true,
serverAccessLogsBucket: accessLoggingBucket,
serverAccessLogsPrefix: props.serverAccessLogsPrefix,
Expand Down
Loading

0 comments on commit cd39599

Please sign in to comment.