-
Notifications
You must be signed in to change notification settings - Fork 133
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
Conversation
scripts/publish.sh
Outdated
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" | ||
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense 👍
scripts/publish.sh
Outdated
@@ -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 |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
scripts/publish.sh
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
Looks good to me. Once minor feedbacks are addressed, we are good to go. |
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? |
The first one. We are not verifying from an ARM environment, right? |
Yes, we are not verifying that part. |
b4baa13
to
5da9c8f
Compare
There was a problem hiding this 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.
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 |
There was a problem hiding this comment.
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 '_' '-')
for arch in "${ARCHITECTURES[@]}" | ||
do | ||
docker manifest annotate --arch "$arch" \ | ||
${1}:${tag} \ | ||
${1}:"$arch"-${AWS_FOR_FLUENT_BIT_VERSION} |
There was a problem hiding this comment.
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
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" |
There was a problem hiding this comment.
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
Support for ARM64 build
#44
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.