-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df7476e
commit 677f97d
Showing
44 changed files
with
11,921 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
41 changes: 41 additions & 0 deletions
41
demos-pipeline/example_3p/assets/demo/qemu/build.buildspec.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
version: 0.2 | ||
run-as: yoctouser | ||
|
||
env: | ||
shell: bash | ||
|
||
phases: | ||
pre_build: | ||
run-as: root | ||
commands: | ||
- chown -R yoctouser /sstate-cache | ||
- chown -R yoctouser /downloads | ||
- chown yoctouser /build-output | ||
- chmod 755 /sstate-cache | ||
- chmod 755 /downloads | ||
- chmod 755 /build-output | ||
# Maybe not needed? | ||
- find /sstate-cache -atime +30 -delete | ||
- find /downloads -atime +30 -delete | ||
build: | ||
commands: | ||
- echo Build started on `date` | ||
- . oe-init-build-env $TMP_DIR | ||
- bitbake core-image-minimal | ||
|
||
post_build: | ||
commands: | ||
- echo Build completed on `date` | ||
- bitbake -m | ||
- ps aux | grep bitbake | ||
- find $TMP_DIR -name '*.socket' -delete | ||
- export BUILD_OUTPUT="$(uuidgen -t).tar" | ||
- tar cf $BUILD_OUTPUT -C $TMP_DIR tmp | ||
- cp -r $BUILD_OUTPUT /build-output | ||
- echo $BUILD_OUTPUT > /build-output/tmpfile | ||
|
||
artifacts: | ||
discard-paths: true | ||
files: | ||
- /build-output/tmpfile | ||
- $TMP_DIR/tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/usr/bin/env node | ||
import * as cdk from "aws-cdk-lib"; | ||
import { AdvancedPipelineStack, AdvancedDeviceKind } from "aws4embeddedlinux-cdk-lib"; | ||
import { BuildImageDataStack } from "aws4embeddedlinux-cdk-lib"; | ||
import { BuildImagePipelineStack, ImageKind } from "aws4embeddedlinux-cdk-lib"; | ||
import { BuildImageRepoStack } from "aws4embeddedlinux-cdk-lib"; | ||
import { PipelineNetworkStack } from "aws4embeddedlinux-cdk-lib"; | ||
|
||
const app = new cdk.App(); | ||
|
||
/** | ||
* User Data | ||
*/ | ||
const env = { | ||
account: process.env.CDK_DEFAULT_ACCOUNT, | ||
region: process.env.CDK_DEFAULT_REGION, | ||
}; | ||
|
||
const githubRepository = { | ||
org: process.env.GH_ORG ?? "yoctoproject", | ||
repo: process.env.GH_REPO ?? "poky", | ||
branch: process.env.GH_BRANCH ?? "master-next", | ||
}; | ||
|
||
/** | ||
* Use these default props to enable termination protection and tag related AWS | ||
* Resources for tracking purposes. | ||
*/ | ||
const defaultProps: cdk.StackProps = { | ||
tags: { PURPOSE: "META-AWS-BUILD" }, | ||
terminationProtection: false, | ||
env, | ||
}; | ||
|
||
/** | ||
* Set up the Stacks that create our Build Host. | ||
*/ | ||
const buildImageData = new BuildImageDataStack(app, "BuildImageData", { | ||
...defaultProps, | ||
bucketName: `build-image-data-${env.account}-${env.region}`, | ||
}); | ||
|
||
const buildImageRepo = new BuildImageRepoStack(app, "BuildImageRepo", { | ||
...defaultProps, | ||
}); | ||
|
||
new BuildImagePipelineStack(app, "BuildImagePipeline", { | ||
...defaultProps, | ||
dataBucket: buildImageData.bucket, | ||
repository: buildImageRepo.repository, | ||
imageKind: ImageKind.Ubuntu22_04, | ||
}); | ||
|
||
/** | ||
* Set up networking to allow us to securely attach EFS to our CodeBuild instances. | ||
*/ | ||
const vpc = new PipelineNetworkStack(app, "SimplePipelineNetwork", { | ||
...defaultProps, | ||
}); | ||
|
||
|
||
/** | ||
* Create a poky pipeline. | ||
*/ | ||
new AdvancedPipelineStack(app, "three-p-Pipeline", { | ||
...defaultProps, | ||
githubOrg: githubRepository.org, | ||
githubRepo: githubRepository.repo, | ||
githubBranch: githubRepository.branch, | ||
imageRepo: buildImageRepo.repository, | ||
imageTag: ImageKind.Ubuntu22_04, | ||
device: AdvancedDeviceKind.Qemu, | ||
vpc: vpc.vpc, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"app": "npx ts-node --prefer-ts-exts bin/3p-pipeline.ts", | ||
"poky-pipeline": "npx ts-node --prefer-ts-exts bin/3p-pipeline.ts", | ||
"watch": { | ||
"include": ["**"], | ||
"exclude": [ | ||
"README.md", | ||
"cdk*.json", | ||
"**/*.d.ts", | ||
"**/*.js", | ||
"tsconfig.json", | ||
"package*.json", | ||
"yarn.lock", | ||
"node_modules", | ||
"test" | ||
] | ||
}, | ||
"context": { | ||
"@aws-cdk-lib/aws-lambda:recognizeLayerVersion": true, | ||
"@aws-cdk-lib/core:checkSecretUsage": true, | ||
"@aws-cdk-lib/core:target-partitions": ["aws", "aws-cn"], | ||
"@aws-cdk-lib-containers/ecs-service-extensions:enableDefaultLogDriver": true, | ||
"@aws-cdk-lib/aws-ec2:uniqueImdsv2TemplateName": true, | ||
"@aws-cdk-lib/aws-ecs:arnFormatIncludesClusterName": true, | ||
"@aws-cdk-lib/aws-iam:minimizePolicies": true, | ||
"@aws-cdk-lib/core:validateSnapshotRemovalPolicy": true, | ||
"@aws-cdk-lib/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true, | ||
"@aws-cdk-lib/aws-s3:createDefaultLoggingPolicy": true, | ||
"@aws-cdk-lib/aws-sns-subscriptions:restrictSqsDescryption": true, | ||
"@aws-cdk-lib/aws-apigateway:disableCloudWatchRole": true, | ||
"@aws-cdk-lib/core:enablePartitionLiterals": true, | ||
"@aws-cdk-lib/aws-events:eventsTargetQueueSameAccount": true, | ||
"@aws-cdk-lib/aws-iam:standardizedServicePrincipals": true, | ||
"@aws-cdk-lib/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true, | ||
"@aws-cdk-lib/aws-iam:importedRoleStackSafeDefaultPolicyName": true, | ||
"@aws-cdk-lib/aws-s3:serverAccessLogsUseBucketPolicy": true, | ||
"@aws-cdk-lib/aws-route53-patters:useCertificate": true, | ||
"@aws-cdk-lib/customresources:installLatestAwsSdkDefault": false, | ||
"@aws-cdk-lib/aws-rds:databaseProxyUniqueResourceName": true, | ||
"@aws-cdk-lib/aws-codedeploy:removeAlarmsFromDeploymentGroup": true, | ||
"@aws-cdk-lib/aws-apigateway:authorizerChangeDeploymentLogicalId": true, | ||
"@aws-cdk-lib/aws-ec2:launchTemplateDefaultUserData": true, | ||
"@aws-cdk-lib/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments": true, | ||
"@aws-cdk-lib/aws-redshift:columnId": true, | ||
"@aws-cdk-lib/aws-stepfunctions-tasks:enableEmrServicePolicyV2": true, | ||
"@aws-cdk-lib/aws-ec2:restrictDefaultSecurityGroup": true, | ||
"@aws-cdk-lib/aws-apigateway:requestValidatorUniqueId": true, | ||
"@aws-cdk-lib/aws-kms:aliasNameRef": true, | ||
"@aws-cdk-lib/core:includePrefixInUniqueNameGeneration": true | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "poky-pipeline", | ||
"version": "0.1.0", | ||
"bin": { | ||
"demos-pipeline": "bin/poky-pipeline.js" | ||
}, | ||
"scripts": { | ||
"clean": "tsc --build --clean && rm -rf dist && rm -rf cdk.out", | ||
"build": "tsc", | ||
"prebuild": "cd ../lib/ && npm install && npm run zip-data", | ||
"watch": "tsc -w", | ||
"test": "jest", | ||
"cdk": "cdk", | ||
"doc": "typedoc", | ||
"format": "eslint '**/*.{js,ts,json}' --quiet --fix", | ||
"check": "eslint '**/*.{js,ts,json}'" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^29.5.1", | ||
"@types/node": "20.1.0", | ||
"@typescript-eslint/eslint-plugin": "^5.59.6", | ||
"@typescript-eslint/parser": "^5.59.6", | ||
"aws-cdk-lib": "2.86.0", | ||
"eslint": "^8.40.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"jest": "^29.5.0", | ||
"prettier": "^2.8.8", | ||
"ts-jest": "^29.1.0", | ||
"ts-node": "^10.9.1", | ||
"typedoc": "^0.24.8", | ||
"typescript": "~5.0.4" | ||
}, | ||
"dependencies": { | ||
"aws4embeddedlinux-cdk-lib": "file:../lib/lib", | ||
"aws-cdk-lib": "2.86.0", | ||
"constructs": "^10.0.0", | ||
"source-map-support": "^0.5.21" | ||
} | ||
} | ||
|
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
npm_modules/ | ||
dist/ | ||
cdk.out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
!jest.config.js | ||
!.eslintrc.js | ||
!.prettierrc.js | ||
*.js | ||
*.d.ts | ||
node_modules | ||
dist | ||
|
||
# CDK asset staging directory | ||
.cdk.staging | ||
cdk.out | ||
|
||
cdk.context.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*.ts | ||
!*.d.ts | ||
|
||
# CDK asset staging directory | ||
.cdk.staging | ||
cdk.out | ||
|
||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Meta-AWS CDK Library | ||
|
||
An AWS [Cloud Developer Toolkit](https://docs.aws.amazon.com/cdk/v2/guide/home.html) Library for building Yocto projects in AWS. | ||
|
||
## Quickstart | ||
|
||
Refer to [`docs/setup.md`](docs/setup.md) | ||
|
||
## Useful commands | ||
|
||
- `npm run build` compile typescript to js | ||
- `npm run watch` watch for changes and compile | ||
- `npm run test` perform the jest unit tests | ||
- `cdk deploy` deploy this stack to your default AWS account/region | ||
- `cdk diff` compare deployed stack with current state | ||
- `cdk synth` emits the synthesized CloudFormation template | ||
|
||
Project Specific: | ||
- `npm run format` runs prettier and eslint on the repository | ||
- `npm run zip-data` bundles the files for creating build host containers | ||
- `npm run check` checks for lint and format issues | ||
- `npm run docs` to generate documentation | ||
|
||
## Contributing | ||
|
||
TODO: Notes contribution process (pre-commit, running tests, formatting and test standards, etc) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
demos-pipeline/examples/cdk.json → demos-pipeline/example_demos/cdk.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Setting Up | ||
|
||
1. Fork `meta-aws-demos` repository. | ||
1. Create a GitHub [`CodeStar Connection`](https://docs.aws.amazon.com/dtconsole/latest/userguide/connections-create-github.html) with access to your Fork. | ||
1. Run the following: | ||
``` | ||
npm install . | ||
npm run build | ||
cdk bootstrap | ||
export GH_ORG=[owner of the fork created above - default is aws4embeddedlinux] | ||
cdk deploy --context connectionarn=[CODESTAR_CONNECTION_ARN] --all | ||
``` | ||
|
||
Run the newly created pipeline `ubuntu_22_04BuildImagePipeline` from the CodePipeline console page to create the build host. | ||
|
||
After that completes, the DemoPipeline in the CodePipeline console page is ready to run. |
Oops, something went wrong.