-
Notifications
You must be signed in to change notification settings - Fork 83
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
image: Port to go-digest #104
Conversation
Except need reabase, looks good to me |
@wking should we also use digest type in
|
I think we should be using the image-spec type directly (and opencontainers/image-spec#514 is in flight to make that change there). But either way, that sounds like something we can do in a follow-up PR. |
I can't get the go-digest vendor to stick before I add the consuming code, even with the entry in |
It should be compile-able after reset to 37624b0. |
On Sun, Jan 22, 2017 at 05:24:42PM -0800, xiekeyang wrote:
It should be compile-able after reset to
37624b0.
I agree on the goal. I'm just not clear on how to accomplish that
without squashing this PR down into a single commit (after which it
would be harder to distinguish the code I wrote (which probably needs
manual review) from the code glide injected (which can be reviewed by
re-running glide and checking for differences). Looking at past
updates, handling everthing in a single commit seems to be the
established procedure (#69, #102), but I'd rather avoid that if
possible. However, I have found no way to install a single package
with glide(-vc) before we have local code that consumes the package.
Maybe this is impossible without Masterminds/glide#252? I'll leave
this as it stands for a day or two to see if any glide gurus know the
proper incantation, and then squash it down to a single commit if
nobody has a better idea. If maintainers want to land this PR in the
meantime, they can always use GitHub's squash-and-merge [1].
[1]: https://help.github.com/articles/about-merge-methods-on-github/#squashing-your-merge-commits
|
@wking Please take account my proposal, to squash glide and dependency code to one commit, and keep your writing code as one. That may be better for rolling back. Anyway it is just an alternative. I debug the PR, it works correctly. The PR mostly looks good to me. |
I haven't been able to find a glide invocation to add an unused dependency, so I generated this commit by committing the consuming code (image: Port to go-digest), running update-deps, and then using rebase to swap the order of the two commits: ...add go-digest conumers... $ git commit -sm 'image: Port to go-digest...' $ make update-deps $ git add vendor/github.com/opencontainers/go-digest $ git commit -sm 'vendor/github.com/opencontainers/go-digest: Add dependency...' $ git rebase -i HEAD^^ ...swap the order of the two commits... That way we have the vendored library if someone checks out the consuming commit directly [1]. [1]: opencontainers#104 (comment) Signed-off-by: W. Trevor King <wking@tremily.us>
On Mon, Jan 23, 2017 at 03:46:24AM -0800, xiekeyang wrote:
@wking Please take account my proposal, to squash glide and
dependency code to one commit, and keep your writing code as one.
This is a bit awkward:
1. Add your consuming code and commit.
2. Run update-deps to get glide to vendor the new dependency and commit.
3. Rebase to put the commit from 2 in front of the commit from 1.
but I guess it's a workable way to get glide to do what I need. I've
rebased this commit to do that with c94e7cb → 4cf2903. It still
doesn't squash the three glide commits together (because each of them
is doing a separate glide task), but it does compile successfully at
each commit.
|
@@ -116,15 +115,18 @@ func (d *descriptor) validate(w walker, mts []string) error { | |||
} | |||
|
|||
func (d *descriptor) validateContent(r io.Reader) error { | |||
h := sha256.New() | |||
n, err := io.Copy(h, r) | |||
parsed, err := digest.Parse(d.Digest) |
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.
Just use the OCI descriptor type.
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.
I'd love to (and I do that in #5). However, as I pointed out earlier, that would require making this PR larger (and therefore harder to review). I'll gladly file a follow up PR with that change if we can land this initial go-digest consuming code first.
On Mon, Feb 06, 2017 at 06:11:48PM -0800, Lei Jitang wrote:
@wking let's wait #107 to bump the image-spec and then rebase this pr?
#107 landed, so I've rebased around it. Interestingly, ff477b3 was
able to magically vendor go-digest without writing any consuming code,
although I had been unable to get that working myself [1].
@q384566678, do you remember how you accomplished it?
[1]: #104 (comment)
|
1 similar comment
bugger. Needs a rebase. |
ping @wking CI failed |
Outsource this stuff to avoid duplication of effort. newDescriptor was returning just the hex and createHashedBlob (its only consumer) was fixing that (by the "Normalize the hashed digest" comment) so it didn't have to split the hash (Hex) back off. But that seems confusing to me, so I've fixed newDescriptor to create a non-busted digest which we split back apart in createHashedBlob. Signed-off-by: W. Trevor King <wking@tremily.us>
By editing glide.yaml and then running: $ make update-deps to update the hash. This way we can bump go-digest intentionally when we feel so inclined. Signed-off-by: W. Trevor King <wking@tremily.us>
This is the smallest pivot I could think up (replacing old sha256 imports with go-digest). But I want the go-digest vendoring to land so I can rebase #5 and #40 on top of it. And I expect folks who currently prefer other methods for cleaning up the internal image/* code are also interested in go-digest, so I'm filing this PR to get a base that we hopefully all agree on ;).