Skip to content

aws4embeddedlinux/aws4embeddedlinux-ci-examples

aws4embeddedlinux-ci-examples

This repository shows ways to use the aws4embeddedlinux-ci library.

In order to use these examples, you must set up the CDK, including installing the CDK tool and bootstrapping the account you wish to deploy to. Additionally, you must have Node installed.

Note

This library is tested against Node Versions 22. If these version is not available for your system, we recommend using NVM to install a compatible version.


Setup

Setting environment variables

export AWS_PROFILE="default"
export AWS_DEFAULT_REGION=$(aws configure get region --profile ${AWS_PROFILE})
export AWS_DEFAULT_ACCOUNT=$(aws sts get-caller-identity --query Account --output text --profile ${AWS_PROFILE})

echo "PROFILE : $AWS_PROFILE"
echo "ACCOUNT : $AWS_DEFAULT_ACCOUNT"
echo "REGION  : $AWS_DEFAULT_REGION"

Clone the project

git clone https://github.com/aws4embeddedlinux/aws4embeddedlinux-ci-examples.git
cd aws4embeddedlinux-ci-examples

Bootstrap CDK

Note

Only required once unless you upgrade your cdk version

cdk bootstrap aws://$AWS_DEFAULT_ACCOUNT/$AWS_DEFAULT_REGION

Install packages and build the stack

First move to the cdk folder:

cd cdk

Then you will need to install the CDK library including the aws4embeddedlinux-ci library either using npm:

npm install 
npm run build

of `yarn':

yarn install
yarn build

If you are not familliar with Yarn, please refer to the documentation.

Note

While the CDK projects often do not require that you invoke the build command separately, doing so will ensure various assets in the library are packaged correctly.

Deploying the base image pipeline stack

First, you will need to deploy the base ubuntu image pipeline (aws4el-ci-pipeline-base-image).

cdk deploy aws4el-ci-pipeline-base-image --require-approval never --progress bar

The created pipeline can be found in the AWS console under Developer Tools > Pipeline - CodePipeline > Pipelines.

The newly created pipeline aws4el-ci-pipeline-base-image should start automatically. If not, you can start it manually.

NOTE: The aws4el-ci-pipeline-base-image will need to be successfully completed before other pipelines can work correctly.

Expected build times: 5 minutes

You can check that the pipeline completed sucessfully when the following command returns an *imageIds entry :

aws ecr list-images \
    --repository-name "aws4el-ci-$AWS_DEFAULT_ACCOUNT-$AWS_DEFAULT_REGION-repo" \
    --query "imageIds[?imageTag=='aws4el-ci-pipeline-base-image']"

Once the pipeline completes and the image is available in the ECR repository, the other EmbeddedLinuxPipeline stacks can be created and executed.

Deploying the project pipeline stack

To deploy a specific pipeline type, you can use the following CDK deploy command:

cdk deploy <pipeline-id> --require-approval

where <pipeline-id> can be one or more of the following:

Name Pipeline stack id
Poky aws4el-ci-pipeline-poky
Poky Ami aws4el-ci-pipeline-poky-ami
Qemu Embedded Linux aws4el-ci-pipeline-qemu
Kas aws4el-ci-pipeline-kas
Renesas aws4el-ci-pipeline-renesas
NXP-IMX aws4el-ci-pipeline-nxp-imx
Custom aws4el-ci-pipeline-custom

Again, the created pipeline can be found in the AWS console under Developer Tools > Pipeline - CodePipeline > Pipelines.

NXP-IMX

The deployed pipeline for NXP-IMX will not complete as you should first accept the EULA and update the build.buildspec.yml file accordingly. See the IMX Yocto Users Guide for more detail.

The source files are available in a S3 bucket that you can get with the following command:

aws cloudformation describe-stacks \
    --stack-name aws4el-ci-pipeline-nxp-imx \
    --output text \
    --query "Stacks[0].Outputs[?OutputKey=='SourceURI'].OutputValue"

Once you have adjusted the content, you can update and upload the zip back to Amazon S3, and the pipeline will restart.

Renesas

The deployed pipeline for Renesas will complete. However, it won't include the Multimedia and Graphics library and related Linux drivers. See the Renesas section for more detail. The source files are available in a S3 bucket that you can get with the following command:

  aws cloudformation describe-stacks \
    --stack-name aws4el-ci-pipeline-renesas \
    --output text \
    --query "Stacks[0].Outputs[?OutputKey=='SourceURI'].OutputValue"

Once you have adjusted the content, you can update and upload the zip back to Amazon S3, and the pipeline will restart.

Custom Pipeline

When using the Custom pipeline, you will need to provide your own build.buildspec.yml file.

To do so, you will provide a path in one of the EmbeddedLinuxCodePipelineStack props (sourceCustomPath property). This path repsent the folder where the build.buildspec.yml file is located. Make sure to use a full path instead of a relative path to avoid any issues.

If the build.buildspec.yml file is not present in the provided folder path, the stack will fail to deploy.

You can also provide any additional files need to execute your build in the same folder.

To deploy all the example pipelines, you can use the CDK deploy command:

cdk deploy aws4el-ci-pipelines --require-approval never --concurrency 3

Note

aws4el-ci-pipelinesis an empty stack that depends on the other stacks, so that if you deploy it, it will deploy the others.

Cleanup

The cdk destroy command can be used to remove individual pipelines and their related resources. This can also be done in the CloudFormation Console Page.

Do not delete stacks while a CodePipeline is running, this can lead to unexpected failures!

To remove all the resources associated with this application:

cdk destroy --all --force

Security

See SECURITY for more information.

Contributing

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.