Skip to content

Commit

Permalink
Merge pull request #7 from aws4embeddedlinux/cleanup-ami-build
Browse files Browse the repository at this point in the history
Cleanup ami build
  • Loading branch information
alinadima authored Sep 11, 2023
2 parents 7786c55 + 76b1184 commit 76d036c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
8 changes: 5 additions & 3 deletions assets/build-image/ubuntu_22_04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
gawk wget git diffstat unzip texinfo gcc build-essential chrpath \
socat cpio python3 python3-pip python3-pexpect xz-utils debianutils \
iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \
python3-subunit mesa-common-dev zstd liblz4-tool file locales \
python3-subunit mesa-common-dev zstd liblz4-tool file locales

# Install packages used elsewhere in the build
RUN apt-get install -y --no-install-recommends \
uuid-runtime sysstat iproute2 openssh-client curl python-is-python3 \
parted mtools dosfstools jq
parted mtools dosfstools jq gpg gpg-agent qemu-utils

# install repo tool
RUN curl https://storage.googleapis.com/git-repo-downloads/repo > /bin/repo
Expand Down Expand Up @@ -44,5 +47,4 @@ ENV TMP_DIR=/tmp
ENV OUTPUT_DIR=/build-output
ENV BB_ENV_PASSTHROUGH_ADDITIONS="SSTATE_DIR DL_DIR"


USER yoctouser
2 changes: 0 additions & 2 deletions source-repo/poky-ami/build.buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ phases:
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
build:
commands:
- echo Build started on `date`
Expand Down
11 changes: 7 additions & 4 deletions source-repo/poky-ami/create-ec2-ami.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,19 @@ echo TARGET_ARCH=$TARGET_ARCH
echo IMAGE_ROOTFS_SIZE=$IMAGE_ROOTFS_SIZE
echo AMI_DISK_SIZE_GB=$AMI_DISK_SIZE_GB

echo "Pushing image ${IMAGE_NAME}.wic.vhdx to s3://${IMPORT_BUCKET_NAME}"
aws s3 cp ${IMG_DIR}/${IMAGE_NAME}.wic.vhdx s3://${IMPORT_BUCKET_NAME}
echo "Converting ${IMAGE_NAME}.wic.vhdx to raw format"
qemu-img convert -f vhdx -O raw ${IMG_DIR}/${IMAGE_NAME}.wic.vhdx ${IMG_DIR}/${IMAGE_NAME}.rootfs.raw

echo "Pushing image ${IMAGE_NAME}.rootfs.raw to s3://${IMPORT_BUCKET_NAME}"
aws s3 cp ${IMG_DIR}/${IMAGE_NAME}.rootfs.raw s3://${IMPORT_BUCKET_NAME}

cat <<EOF > image-import.json
{
"Description": "ewaol docker image",
"Format": "vhd",
"Format": "raw",
"UserBucket": {
"S3Bucket": "${IMPORT_BUCKET_NAME}",
"S3Key": "${IMAGE_NAME}.wic.vhdx"
"S3Key": "${IMAGE_NAME}.rootfs.raw"
}
}
EOF
Expand Down
4 changes: 2 additions & 2 deletions test/__snapshots__/demo-pipeline.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1892,7 +1892,7 @@ def handler(event, context):
"BranchName": "main",
"S3": {
"Bucket": "cdk-hnb659fds-assets-12341234-eu-central-1",
"Key": "865830eb5443958ec2335bf76f58c4c52d224bc2d332815668ab798dab13b009.zip",
"Key": "51cdb1798371a3656fb7f604ae18cd5413a8b77fd2d565a307072e1ba9e1aa2e.zip",
},
},
"RepositoryName": "layer-repo-PokyAmiPipeline2ExportsOutputFnGetAttPipelineVpc0543904ACidrBlock70DEC992",
Expand Down Expand Up @@ -3952,7 +3952,7 @@ def handler(event, context):
"BranchName": "main",
"S3": {
"Bucket": "cdk-hnb659fds-assets-12341234-eu-central-1",
"Key": "865830eb5443958ec2335bf76f58c4c52d224bc2d332815668ab798dab13b009.zip",
"Key": "51cdb1798371a3656fb7f604ae18cd5413a8b77fd2d565a307072e1ba9e1aa2e.zip",
},
},
"RepositoryName": "layer-repo-MyTestStack",
Expand Down

0 comments on commit 76d036c

Please sign in to comment.