Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
amazon-auto authored and thomas-roos committed Jul 6, 2023
0 parents commit 9601daa
Show file tree
Hide file tree
Showing 41 changed files with 4,026 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
npm_modules/
dist/
cdk.out/
28 changes: 28 additions & 0 deletions .github/workflows/test-cdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Test CDK
on:
workflow_dispatch:
push:
branches: ["**"]
paths: ["lib/**"]
pull_request:
branches: [master]
paths: ["lib/**"]
jobs:
Run-CDK-Tests:
runs-on: ubuntu-latest

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

steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run check
- run: npm run build --if-present
- run: npm test
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.js
!jest.config.js
*.d.ts
node_modules
dist

# CDK asset staging directory
.cdk.staging
cdk.out
6 changes: 6 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.ts
!*.d.ts

# CDK asset staging directory
.cdk.staging
cdk.out
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Amazon.com, Inc. All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# aws4embeddedlinux-build

This repository contains [buildbot](https://buildbot.net/) using [AWS CDK](https://aws.amazon.com/cdk/) to run [Yocto](https://www.yoctoproject.org/) embedded Linux build jobs in AWS.


## Code structure

This is a standard CDK project.

The main stack definition can be found in [`lib/app.ts`](lib/app.ts).


## Requirements and deployment

In order to be able to deploy this CDK project you need to have the following:

- An AWS account
- The [AWS CLI](https://aws.amazon.com/cli/) installed and configured in your development machine
- [AWS CDK](https://aws.amazon.com/cdk/) installed and configured in your development machine
- Node.js and npm installed

Then to deploy this CDK project to your AWS account, you simply have to clone this repository and from the root folder of the project run:

```bash
npm install
```

To install the necessary dependencies, and then:

```bash
npm run build
npm run zip-config
cdk deploy --all
```

To synthesise and deploy the project stack.

Then prompt `y` for yes.

If you want to clean up your account you can delete this stack with:

```bash
cdk destroy
```


## Contributing

Everyone is very welcome to contribute to this project.
You can contribute just by submitting bugs or suggesting improvements by
opening an issue on GitHub.


## License

Licensed under [MIT License](LICENSE.md).
3 changes: 3 additions & 0 deletions cdk.context.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"availability-zones:account=743600277648:region=eu-central-1": ["eu-central-1a", "eu-central-1b", "eu-central-1c"]
}
10 changes: 10 additions & 0 deletions cdk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"app": "node dist/lib/app",
"amzn": {
"cdk-build": {
"build": "npm-pretty-much",
"version": 1
}
},
"output": "dist/cdk.out"
}
1 change: 1 addition & 0 deletions configuration/admin/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.zip
2 changes: 2 additions & 0 deletions configuration/admin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.zip
venv/
33 changes: 33 additions & 0 deletions configuration/admin/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM public.ecr.aws/lts/ubuntu:22.04_stable

RUN apt-get update && apt-get install -y build-essential python3-dev libssl-dev \
libffi-dev python3-pip python3-venv git

# DEBUG
RUN apt-get install -y psmisc vim lsof nmap iputils-ping curl
# DEBUG

RUN useradd -U -m user

USER user
WORKDIR /home/user

EXPOSE 8010
EXPOSE 9989

RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install boto3 botocore
RUN python3 -m pip install git-remote-codecommit
RUN python3 -m pip install 'buildbot[bundle]'

ENV PATH="/home/user/.local/bin:${PATH}"

RUN buildbot create-master .
COPY admin.cfg .
COPY envfile .
COPY entry.sh .
RUN mkdir userconfig
RUN chown -R user: userconfiguration/
COPY user.cfg userconfiguration/

ENTRYPOINT [ "./entry.sh" ]
27 changes: 27 additions & 0 deletions configuration/admin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Setting up:

* Deploy source bucket and pipeline then use the bucket name below.

```
# Zip the needed files.
zip -o config.zip buildspec.yml Dockerfile entry.sh master.cfg
# S3 CP to the config key.
aws --profile PROFILE s3 cp config.zip s3://BUCKET/config
```

Running locally:
```
docker build -t buildbot:latest .
# Does not include worker port, found in the master.cfg
docker run -p 8010:8010 buildbot:latest
```

Development Setup
```
python3 -m venv venv
. ./venv/bin/activate
pip install -r dev-requirements.txt
```

Loading

0 comments on commit 9601daa

Please sign in to comment.