Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for ARM64 build #71

Merged
merged 1 commit into from
Sep 16, 2020
Merged

Support for ARM64 build #71

merged 1 commit into from
Sep 16, 2020

Conversation

MeghnaPrabhu
Copy link
Contributor

@MeghnaPrabhu MeghnaPrabhu commented Sep 15, 2020

Support for ARM64 build
#44

Description of changes:

  • PR does not include the changes for sync task. I will publish a separate PR for that.
  • Pipeline stages have been modified to allow for parallel multi-arch image builds (x86-64 and ARM64).

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Comment on lines 46 to 54
classic_regions_account_id="906394416424"
classic_regions_account_id="957584016365"

cn_regions="
cn-north-1
cn-northwest-1
"

cn_regions_account_id="128054284489"
cn_regions_account_id="957584016365"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guessing this is left over from testing- account IDs should not change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will switch these from my personal ID as the last commit before merge.

- docker manifest inspect ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:latest || true

# Push manifest list
- docker manifest push ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:latest || true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to do a OR with true ( || true) every time? Shouldn't it return an error code if it fails?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like I mentioned above, since both instances are running in parallel, only the one that executes last will be able to create the manifest list successfully. We need both the images to be pushed to ECR before the manifest list is created. At the same time, build should not fail if it is waiting for the image of the other architecture to be available, this is why we have the || True

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine, but then we need the verify step to check that the manifest list was published properly. Otherwise its possible for both instances to fail without us knowing, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a good point, I thought about it. However, if the manifest list does not get created properly, it will fail immediately in the integ-test stage. This is because we start each stage by pulling the image from the manifest list that was created during the build.

Adding a verification step in the publish to ecr stage will not be very useful because by then it is established that we have the manifest file working correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally, this case of ||true only occurs in the build stage because we are running both instances in parallel. Other stages like publish to ecr are all running on a single instance. Hence, we can be sure that the manifest list created in the publish to ecr stage has both the images as we will be pushing them individually to ECR before creating the manifest.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense 👍

@@ -259,7 +308,7 @@ match_two_sha() {

if [ "${1}" = "publish" ]; then
if [ "${2}" = "dockerhub" ]; then
publish_to_docker_hub amazon/aws-for-fluent-bit:latest amazon/aws-for-fluent-bit:${AWS_FOR_FLUENT_BIT_VERSION}
publish_to_docker_hub amazon/aws-for-fluent-bit meghnaprabhu/aws-for-fluent-bit
Copy link
Contributor

@hossain-rayhan hossain-rayhan Sep 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to replace meghnaprabhu with amazon.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will replace that as the last step along with the account ID

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I can see both of the values are same. If we are not using the 2nd parameter (fluent-bit-version), we can remove it.

@@ -417,7 +466,7 @@ fi
# Following scripts will be called only from the CI/CD pipeline
if [ "${1}" = "cicd-publish" ]; then
if [ "${2}" = "dockerhub" ]; then
publish_to_docker_hub amazon/aws-for-fluent-bit:latest amazon/aws-for-fluent-bit:${AWS_FOR_FLUENT_BIT_VERSION}
publish_to_docker_hub amazon/aws-for-fluent-bit meghnaprabhu/aws-for-fluent-bit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@hossain-rayhan
Copy link
Contributor

Looks good to me. Once minor feedbacks are addressed, we are good to go.
One thing, I didn't see any changes for the verification. Is there no way to make sure customers are getting the proper ARM64 image?

@MeghnaPrabhu
Copy link
Contributor Author

For verification did you mean verify if docker pull from a manifest list actually gives you ARM image or did you mean verification of the SHA between tags AWS_FOR_FLUENT_BIT_VERSION and latest?

@hossain-rayhan
Copy link
Contributor

The first one. We are not verifying from an ARM environment, right?

@MeghnaPrabhu
Copy link
Contributor Author

MeghnaPrabhu commented Sep 15, 2020

Yes, we are not verifying that part.
It is guaranteed by docker, if you issue a docker pull on a manifest file, docker will return the image compatible with the underlying architecture.

Copy link
Contributor

@hossain-rayhan hossain-rayhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Comment on lines +5 to +10
ARCHITECTURE=$(uname -m)
if [ ARCHITECTURE=="x86_64" ]
then
ARCHITECTURE="x86-64"
fi
aws cloudformation deploy --template-file ./integ/resources/cfn-kinesis-s3-firehose.yml --stack-name integ-test-fluent-bit-${ARCHITECTURE} --region us-west-2 --capabilities CAPABILITY_NAMED_IAM
Copy link
Contributor

@PettitWesley PettitWesley Sep 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion, replace the if with:

ARCHITECTURE=$(uname -m | tr '_' '-')

Comment on lines +199 to +203
for arch in "${ARCHITECTURES[@]}"
do
docker manifest annotate --arch "$arch" \
${1}:${tag} \
${1}:"$arch"-${AWS_FOR_FLUENT_BIT_VERSION}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird indent on one line

Comment on lines +241 to +244
push_image_ecr ${account_id} ${region}

create_manifest_list ${account_id}.dkr.ecr.${region}.amazonaws.com/aws-for-fluent-bit ${AWS_FOR_FLUENT_BIT_VERSION}
create_manifest_list ${account_id}.dkr.ecr.${region}.amazonaws.com/aws-for-fluent-bit "latest"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird indent on one line

@hossain-rayhan hossain-rayhan merged commit 28b23f6 into aws:master Sep 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants