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 an issue accessing the Config when we mutate it. #88

Merged
merged 1 commit into from
Apr 21, 2018

Conversation

mattmoor
Copy link
Collaborator

We were changing the ConfigFile.Config, but we weren't updating the Manifest's digest for the ConfigFile. This meant that things keying off of the Manifest's ConfigFile digest field to access things through LayerByDigest would end up being delegated to the base image's implementation. In my case, this was manifesting as us asking GCR for a non-existent blob (remote.Image).

Related: #87

@@ -132,6 +132,10 @@ func Config(base v1.Image, cfg v1.Config) (v1.Image, error) {
diffIDMap: make(map[v1.Hash]v1.Layer),
digestMap: make(map[v1.Hash]v1.Layer),
}
image.manifest.Config.Digest, err = image.ConfigName()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I haven't read through all of this file, but we do this above in Append, do we need to do it here too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This doesn't call append :)

@dlorenc
Copy link
Contributor

dlorenc commented Apr 21, 2018

if you rebase you'll pick up my patch that ignores vendor/ in gofmt.

@mattmoor
Copy link
Collaborator Author

I fixed the test

if !manifestsAreEqual(t, source, result) {
t.Fatal("mutating the config mutated the manifest")
if manifestsAreEqual(t, source, result) {
t.Fatal("mutating the config MUST the manifest")
Copy link
Collaborator

Choose a reason for hiding this comment

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

MUST mutate

We were changing the `ConfigFile.Config`, but we weren't updating the `Manifest`'s digest for the `ConfigFile`.  This meant that things keying off of the `Manifest`'s `ConfigFile` digest field to access things through `LayerByDigest` would end up being delegated to the base image's implementation.  In my case, this was manifesting as us asking GCR for a non-existent blob (`remote.Image`).

Related: google#87
@mattmoor mattmoor merged commit 8349376 into google:master Apr 21, 2018
@mattmoor mattmoor deleted the fix-config-mutation branch April 21, 2018 21:11
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.

3 participants