-
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
disable digest resolution for manifest v2 schema 1 manifests #4249
Conversation
agent/engine/docker_task_engine.go
Outdated
field.ImageMediatype: imageManifestMediatype, | ||
field.Image: container.Image, | ||
}) | ||
if strings.Contains(imageManifestMediatype, "application/vnd.docker.distribution.manifest.v1") { |
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.
Let's create constants for the two possible media type values for Schema 1 and use the constants here.
Kinda like this
https://github.com/distribution/distribution/blob/release/2.8/manifest/schema1/manifest.go#L14-L18
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.
thanks! updated
agent/engine/docker_task_engine.go
Outdated
field.ImageMediaType: imageManifestMediaType, | ||
field.Image: container.Image, | ||
}) | ||
if strings.Contains(imageManifestMediaType, mediaTypeManifestV1) || strings.Contains(imageManifestMediaType, mediaTypeSignedManifestV1) { |
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 want to do strings.Contains
instead of just ==
?
Summary
ECS Agent will disable the digest resolution for Schema 1 manifest as a workaround for a bug in ECR that ECR will reports an incorrect digest during digest resolution phase for Schema V1 manifests which then causes image pull using the digest to fail.
Implementation details
skip digest resolution for manifest v2 schema 1 manifests
Testing
Reproduce the issue by setting Up Pull-Through Cache Rule
Manually ran a task with schema 1 image 130669029530.dkr.ecr.us-west-2.amazonaws.com/quay/coreos/etcd:v2.0.4, we can see error " image verification failed for digest "
Manually ran a task with schema 1 image 130669029530.dkr.ecr.us-west-2.amazonaws.com/quay/coreos/etcd:v2.0.4 with test agent(changes of this pr), we can see digest resolution is skipped and pulling image complete.
New tests cover the changes:
Description for the changelog
Bugfix: Disable Digest Resolution for Manifest V2 Schema 1
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.