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

Switch digest to contentDigest in the json tags #75

Merged
merged 2 commits into from
Jul 24, 2019

Conversation

jeremyrickard
Copy link
Member

This PR swaps contentDigest in place of digest in the json/mapstructure tags for the BaseImage type. Adds a test for marashalling as well.

Fixes #59

"schemaVersion": "99.99",
"images": {
"my-microservice": {
"contentDigest": "sha256:aaaaaaaaaaaa...",
Copy link
Contributor

Choose a reason for hiding this comment

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

On the basis that open source tests are a form of documentation, I'd prefer it if we used a proper content digest e.g. "sha256:deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" (or a vegetarian alternative).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, good idea. I took this directly from one of the examples in the spec examples directory.

},
"invocationImages": [
{
"contentDigest": "sha256:aaaaaaa...",
Copy link
Contributor

Choose a reason for hiding this comment

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

See previous comment about proper content digest, but use a distinct one here.

}
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: add newline to keep github view clean?

bundle/bundle_test.go Outdated Show resolved Hide resolved
bundle/bundle_test.go Outdated Show resolved Hide resolved
bundle/bundle_test.go Outdated Show resolved Hide resolved
//images[] should have exactly 1 values
_, ok := bundle.Images["my-microservice"]
require.True(t, ok, "there should been an image named my-microservice in the bundle")
// the image digest should equal sha256:aaaaaaaaaaaa...
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: best to delete comments which merely repeat what the code says.

Copy link
Contributor

@glyn glyn left a comment

Choose a reason for hiding this comment

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

Please see detailed comments.

This PR swaps `contentDigest` in place of `digest` in the json/mapstructure tags for the BaseImage type. Adds a test for marashalling as well.

Fixes cnabio#59
@glyn glyn merged commit 098f359 into cnabio:master Jul 24, 2019
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.

[spec compliance] Need to replace "digest" with "contentDigest" in Images/InvocationImages
3 participants