-
Notifications
You must be signed in to change notification settings - Fork 613
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
pull the image with the <image>@<digest> format #4256
Conversation
acc0bb8
to
1dec67c
Compare
2c23b92
to
9a43be4
Compare
image := "ubuntu@sha256:ed6d2c43c8fbcd3eaa44c9dab6d94cb346234476230dc1681227aa72d07181ee" | ||
assert.False(t, (&Container{Image: image}).DigestResolutionRequired()) | ||
imageDigest := "sha256:ed6d2c43c8fbcd3eaa44c9dab6d94cb346234476230dc1681227aa72d07181ee" |
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.
Referencing to the previous comment, can there be case where we have image but not imageDigest? What should be the expected behavior in that case?
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.
(non blocking) nit: we may consider adding unit test case for the above
Summary
Currently, when agent receives a container image with a tag, the agent first attempts to resolve that tag to its digest. If successful, that digest is sent back to the control plane, while subsequently pulling and launching that image via digest rather than the original tag. This behavior results in the container being shown as launched with the
<image>@<digest>
rather than the customer defined<image>:<tag>
format , so customers have lost information previously available to them, notably the image tag, thus Control Plane will be changingimage@sha256:abcd
toimage:latest@sha256:abcd
for subsequence tasks.docker image pull busybox:latest@sha256:abcd is the same as docker image pull busybox@sha256:abcd
This pr makes agent to pull the image with the
<image>@<digest>
format instead of<image>:tag@<digest>
format no matter what docker version is usedImplementation details
CanonicalRef
agent/utils/reference package that returns a canonical image reference without tag given an image reference and a manifest digest.DigestExists
agent/utils/reference package that check if image reference contains digest<image>:tag@<digest>
. The method tags the pulled image with Container.Image if a different image reference was used to pull the image and container image name not contains digest (<image>:tag@<digest>
will not be tagged)Testing
<image>:tag@<digest>
format<image>@<digest>
,<image>:tag>
and<image>:tag@<digest>
format with an Agent built with changes in this PR, Checked that all tasks ran as expected. Images were pulled using digests and tagged with the image reference in the task definition.<image>:tag>
, verified that a additional STSC is not being made for the second task.New tests cover the changes:
Description for the changelog
Does this PR include breaking model changes? If so, Have you added transformation functions?
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.