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

Fix AL2023 integration tests #4132

Merged
merged 1 commit into from
Apr 8, 2024
Merged

Fix AL2023 integration tests #4132

merged 1 commit into from
Apr 8, 2024

Conversation

Yiyuanzzz
Copy link
Contributor

@Yiyuanzzz Yiyuanzzz commented Apr 3, 2024

Summary

This PR fix failed AL2023 integration tests.

Implementation details

  • pull image before tagging it to fix the issue
    Error response from daemon: No such image: public.ecr.aws/docker/library/busybox:1.34.1
  • swapping the order of factory initialization and client initialization as factory initialization initializes dockerclient.MinDockerAPIVersion to fix the error
    Error response from daemon: client version 1.21 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version

Testing

New tests cover the changes:

Description for the changelog

Fix AL2023 integration tests

Does this PR include breaking model changes? If so, Have you added transformation functions?

no

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@Yiyuanzzz Yiyuanzzz changed the title [DO not review]fix image not exist issue [DO not review]Fix AL2023 integration tests Apr 5, 2024
@Yiyuanzzz Yiyuanzzz changed the title [DO not review]Fix AL2023 integration tests Fix AL2023 integration tests Apr 5, 2024
@@ -52,6 +52,7 @@ fi
# Remove the tag so this image can be deleted successfully in the docker image cleanup integ tests
docker rmi amazon/image-cleanup-test-image1:make amazon/image-cleanup-test-image2:make amazon/image-cleanup-test-image3:make

docker pull public.ecr.aws/docker/library/busybox:1.34.1
mirror_local_image public.ecr.aws/docker/library/busybox:1.34.1 "127.0.0.1:51670/busybox:latest"
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean that on older Docker versions docker tag <remote-image> <new-tag> implicitly did a docker pull <remote-image>?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like not

$ docker version
Client:
 Version:           20.10.25
...
Server:
 Engine:
  Version:          20.10.25
...

$ docker tag public.ecr.aws/docker/library/busybox:1.34.1 my-busybox:latest
Error response from daemon: No such image: public.ecr.aws/docker/library/busybox:1.34.1

Copy link
Contributor

Choose a reason for hiding this comment

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

So why does this script work on AL2?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

one thing I noticed is after we upgrade the docker version , it seem to be loading images from cache, which is different behavior than the old docker version
------now-----
docker build -f "linux0.dockerfile" -t amazon/image-cleanup-test-image1:make .
#0 building with "default" instance using docker driver
#1 [internal] load build definition from linux0.dockerfile
#1 DONE 0.0s
#1 [internal] load build definition from linux0.dockerfile
#1 transferring dockerfile: 799B done
#1 DONE 0.0s
#2 [internal] load metadata for public.ecr.aws/docker/library/busybox:1.34.1
#2 DONE 0.1s
#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.0s
#4 [1/2] FROM public.ecr.aws/docker/library/busybox:1.34.1@sha256:05a79c7279f71f86a2a0d05eb72fcb56ea36139150f0a75cd87e80a4272e4e39
#4 CACHED
#5 [2/2] RUN date > boo.txt
#5 DONE 0.3s
#6 exporting to image
#6 exporting layers 0.0s done
#6 writing image sha256:84ff0055b6122639be634db9dafab883496e1679c373aacd61fcf77a5a5dbff7 done
#6 naming to docker.io/amazon/image-cleanup-test-image1:make done
#6 DONE 0.0s

-----before----
docker build -f "linux0.dockerfile" -t amazon/image-cleanup-test-image1:make .
Sending build context to Docker daemon 25.09kB
Step 1/5 : FROM public.ecr.aws/docker/library/busybox:1.34.1
---> 827365c7baf1
Step 2/5 : MAINTAINER Amazon Web Services, Inc.
---> Using cache
---> 2b3c43b4ded9
Step 3/5 : RUN date > boo.txt
---> Running in 8ba679e67990
Removing intermediate container 8ba679e67990
---> 045ddd173e72
Step 4/5 : ENTRYPOINT ["sh","-c"]
---> Running in 6ba7cb44c6b2
Removing intermediate container 6ba7cb44c6b2
---> c4c998a1ebc0
Step 5/5 : CMD ["sleep 5"]
---> Running in 1926dc4f2f38
Removing intermediate container 1926dc4f2f38
---> bfe53246779e
Successfully built bfe53246779e
Successfully tagged amazon/image-cleanup-test-image1:make

@amogh09 amogh09 self-requested a review April 5, 2024 23:18
@@ -52,6 +52,7 @@ fi
# Remove the tag so this image can be deleted successfully in the docker image cleanup integ tests
docker rmi amazon/image-cleanup-test-image1:make amazon/image-cleanup-test-image2:make amazon/image-cleanup-test-image3:make

docker pull public.ecr.aws/docker/library/busybox:1.34.1
mirror_local_image public.ecr.aws/docker/library/busybox:1.34.1 "127.0.0.1:51670/busybox:latest"
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like not

$ docker version
Client:
 Version:           20.10.25
...
Server:
 Engine:
  Version:          20.10.25
...

$ docker tag public.ecr.aws/docker/library/busybox:1.34.1 my-busybox:latest
Error response from daemon: No such image: public.ecr.aws/docker/library/busybox:1.34.1

@@ -52,6 +52,7 @@ fi
# Remove the tag so this image can be deleted successfully in the docker image cleanup integ tests
docker rmi amazon/image-cleanup-test-image1:make amazon/image-cleanup-test-image2:make amazon/image-cleanup-test-image3:make

docker pull public.ecr.aws/docker/library/busybox:1.34.1
mirror_local_image public.ecr.aws/docker/library/busybox:1.34.1 "127.0.0.1:51670/busybox:latest"
Copy link
Contributor

Choose a reason for hiding this comment

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

So why does this script work on AL2?

@Yiyuanzzz Yiyuanzzz merged commit 7769af5 into aws:dev Apr 8, 2024
39 of 40 checks passed
@harishxr harishxr mentioned this pull request Apr 19, 2024
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