Skip to content

Commit c7bb7b2

Browse files
committed
Initial commit
1 parent 4e36129 commit c7bb7b2

10 files changed

+5887
-9
lines changed

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
npm_modules/
2+
dist/
3+
cdk.out/

.eslintrc.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es2021: true,
5+
node: true,
6+
jest: true,
7+
},
8+
extends: [
9+
"eslint:recommended",
10+
"plugin:@typescript-eslint/recommended",
11+
"plugin:prettier/recommended",
12+
],
13+
overrides: [],
14+
parser: "@typescript-eslint/parser",
15+
parserOptions: {
16+
ecmaVersion: "latest",
17+
sourceType: "module",
18+
},
19+
plugins: ["@typescript-eslint"],
20+
rules: {},
21+
root: true,
22+
};

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules
2+
dist
3+
4+
# CDK asset staging directory
5+
.cdk.staging
6+
cdk.out
7+
8+
cdk.context.json
9+
/aws4embeddedlinux-ci-examples.iml

README.md

+57-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,65 @@
1-
## My Project
1+
# aws4embeddedlinux-ci-examples
22

3-
TODO: Fill this README out!
3+
TODO - This is work in progress
44

5-
Be sure to:
5+
## Quickstart
6+
TODO
67

7-
* Change the title in this README
8-
* Edit your repository description on GitHub
8+
### Setting Up
99

10-
## Security
10+
#### clone repo
1111

12-
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
1312

14-
## License
13+
#### install npm packages:
1514

16-
This library is licensed under the MIT-0 License. See the LICENSE file.
15+
```bash
16+
npm install .
17+
```
1718

19+
#### updating - if you have an already have packages installed before
20+
```bash
21+
npm update
22+
```
23+
24+
#### build:
25+
26+
```bash
27+
npm run build
28+
```
29+
30+
#### deploy cloud resources for all demo pipelines:
31+
```bash
32+
# only required once
33+
cdk bootstrap
34+
35+
cdk deploy --all
36+
```
37+
38+
The newly created pipeline `ubuntu_22_04BuildImagePipeline` from the CodePipeline console will start automatically.
39+
40+
After that completes, the DemoPipeline in the CodePipeline console page is ready to run.
41+
42+
43+
#### destroy cloud resources for all demo pipelines:
44+
```bash
45+
cdk destroy --all
46+
```
47+
48+
## Useful commands
49+
50+
- `npm run build` compile typescript to js
51+
- `npm run watch` watch for changes and compile
52+
- `npm run test` perform the jest unit tests
53+
- `cdk deploy` deploy this stack to your default AWS account/region
54+
- `cdk diff` compare deployed stack with current state
55+
- `cdk synth` emits the synthesized CloudFormation template
56+
57+
Project Specific:
58+
- `npm run format` runs prettier and eslint on the repository
59+
- `npm run zip-data` bundles the files for creating build host containers
60+
- `npm run check` checks for lint and format issues
61+
- `npm run docs` to generate documentation
62+
63+
## Contributing
64+
65+
TODO: Notes contribution process (pre-commit, running tests, formatting and test standards, etc)

bin/poky-pipeline.ts

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
#!/usr/bin/env node
2+
import * as cdk from "aws-cdk-lib";
3+
import {
4+
DemoPipelineStack,
5+
BuildImageDataStack,
6+
BuildImagePipelineStack,
7+
BuildImageRepoStack,
8+
PipelineNetworkStack,
9+
ImageKind,
10+
ProjectKind,
11+
} from "aws4embeddedlinux-cdk-lib";
12+
13+
const app = new cdk.App();
14+
15+
/* See https://docs.aws.amazon.com/sdkref/latest/guide/access.html for details on how to access AWS. */
16+
const env = {
17+
account: process.env.CDK_DEFAULT_ACCOUNT,
18+
region: process.env.CDK_DEFAULT_REGION,
19+
};
20+
21+
/**
22+
* Use these default props to enable termination protection and tag related AWS
23+
* Resources for tracking purposes.
24+
*/
25+
const defaultProps: cdk.StackProps = {
26+
tags: { PURPOSE: "META-AWS-BUILD" },
27+
terminationProtection: false, // TODO: enable or remove.
28+
env,
29+
};
30+
31+
/**
32+
* Set up the Stacks that create our Build Host.
33+
*/
34+
const buildImageData = new BuildImageDataStack(app, "BuildImageData", {
35+
...defaultProps,
36+
bucketName: `build-image-data-${env.account}-${env.region}`,
37+
});
38+
39+
const buildImageRepo = new BuildImageRepoStack(app, "BuildImageRepo", {
40+
...defaultProps,
41+
});
42+
43+
new BuildImagePipelineStack(app, "BuildImagePipeline", {
44+
...defaultProps,
45+
dataBucket: buildImageData.bucket,
46+
repository: buildImageRepo.repository,
47+
imageKind: ImageKind.Ubuntu22_04,
48+
});
49+
50+
/**
51+
* Set up networking to allow us to securely attach EFS to our CodeBuild instances.
52+
*/
53+
const vpc = new PipelineNetworkStack(app, {
54+
...defaultProps,
55+
});
56+
57+
/**
58+
* Create a poky distribution pipeline.
59+
*/
60+
new DemoPipelineStack(app, "PokyPipeline", {
61+
...defaultProps,
62+
imageRepo: buildImageRepo.repository,
63+
imageTag: ImageKind.Ubuntu22_04,
64+
vpc: vpc.vpc,
65+
});
66+
67+
/**
68+
* Create a meta-aws-demos pipeline for the Qemu example.
69+
*/
70+
new DemoPipelineStack(app, "QemuDemoPipeline", {
71+
...defaultProps,
72+
imageRepo: buildImageRepo.repository,
73+
imageTag: ImageKind.Ubuntu22_04,
74+
vpc: vpc.vpc,
75+
layerRepoName: "qemu-demo-layer-repo",
76+
projectKind: ProjectKind.MetaAwsDemo,
77+
});
78+
79+
/**
80+
* Create an AMI based on Poky.
81+
*/
82+
new DemoPipelineStack(app, "PokyAmiPipeline", {
83+
...defaultProps,
84+
imageRepo: buildImageRepo.repository,
85+
imageTag: ImageKind.Ubuntu22_04,
86+
vpc: vpc.vpc,
87+
layerRepoName: "ec2-ami-poky-layer-repo",
88+
projectKind: ProjectKind.PokyAmi,
89+
});
90+
91+
/**
92+
* Create an kas based image.
93+
*/
94+
new DemoPipelineStack(app, "KasPipeline", {
95+
...defaultProps,
96+
imageRepo: buildImageRepo.repository,
97+
imageTag: ImageKind.Ubuntu22_04,
98+
vpc: vpc.vpc,
99+
layerRepoName: "biga-kas-layer-repo",
100+
projectKind: ProjectKind.Kas,
101+
});
102+
103+
/**
104+
* Create an renesas based image.
105+
*/
106+
new DemoPipelineStack(app, "RenesasPipeline", {
107+
...defaultProps,
108+
imageRepo: buildImageRepo.repository,
109+
imageTag: ImageKind.Ubuntu22_04,
110+
vpc: vpc.vpc,
111+
layerRepoName: "renesas-layer-repo",
112+
projectKind: ProjectKind.Renesas,
113+
});

cdk.json

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"app": "npx ts-node --prefer-ts-exts bin/poky-pipeline.ts",
3+
"poky-pipeline": "npx ts-node --prefer-ts-exts bin/poky-pipeline.ts",
4+
"watch": {
5+
"include": ["**"],
6+
"exclude": [
7+
"README.md",
8+
"cdk*.json",
9+
"**/*.d.ts",
10+
"**/*.js",
11+
"tsconfig.json",
12+
"package*.json",
13+
"yarn.lock",
14+
"node_modules",
15+
"test"
16+
]
17+
},
18+
"context": {
19+
"@aws-cdk-lib/aws-lambda:recognizeLayerVersion": true,
20+
"@aws-cdk-lib/core:checkSecretUsage": true,
21+
"@aws-cdk-lib/core:target-partitions": ["aws", "aws-cn"],
22+
"@aws-cdk-lib-containers/ecs-service-extensions:enableDefaultLogDriver": true,
23+
"@aws-cdk-lib/aws-ec2:uniqueImdsv2TemplateName": true,
24+
"@aws-cdk-lib/aws-ecs:arnFormatIncludesClusterName": true,
25+
"@aws-cdk-lib/aws-iam:minimizePolicies": true,
26+
"@aws-cdk-lib/core:validateSnapshotRemovalPolicy": true,
27+
"@aws-cdk-lib/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true,
28+
"@aws-cdk-lib/aws-s3:createDefaultLoggingPolicy": true,
29+
"@aws-cdk-lib/aws-sns-subscriptions:restrictSqsDescryption": true,
30+
"@aws-cdk-lib/aws-apigateway:disableCloudWatchRole": true,
31+
"@aws-cdk-lib/core:enablePartitionLiterals": true,
32+
"@aws-cdk-lib/aws-events:eventsTargetQueueSameAccount": true,
33+
"@aws-cdk-lib/aws-iam:standardizedServicePrincipals": true,
34+
"@aws-cdk-lib/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true,
35+
"@aws-cdk-lib/aws-iam:importedRoleStackSafeDefaultPolicyName": true,
36+
"@aws-cdk-lib/aws-s3:serverAccessLogsUseBucketPolicy": true,
37+
"@aws-cdk-lib/aws-route53-patters:useCertificate": true,
38+
"@aws-cdk-lib/customresources:installLatestAwsSdkDefault": false,
39+
"@aws-cdk-lib/aws-rds:databaseProxyUniqueResourceName": true,
40+
"@aws-cdk-lib/aws-codedeploy:removeAlarmsFromDeploymentGroup": true,
41+
"@aws-cdk-lib/aws-apigateway:authorizerChangeDeploymentLogicalId": true,
42+
"@aws-cdk-lib/aws-ec2:launchTemplateDefaultUserData": true,
43+
"@aws-cdk-lib/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments": true,
44+
"@aws-cdk-lib/aws-redshift:columnId": true,
45+
"@aws-cdk-lib/aws-stepfunctions-tasks:enableEmrServicePolicyV2": true,
46+
"@aws-cdk-lib/aws-ec2:restrictDefaultSecurityGroup": true,
47+
"@aws-cdk-lib/aws-apigateway:requestValidatorUniqueId": true,
48+
"@aws-cdk-lib/aws-kms:aliasNameRef": true,
49+
"@aws-cdk-lib/core:includePrefixInUniqueNameGeneration": true
50+
}
51+
}

0 commit comments

Comments
 (0)