Update 'buf mod update' to check digest changes#1874
Merged
Conversation
If 'buf mod update' runs and resolves to the same module identity and commit, it should error out if the digest doesn't match what is recorded in the buf.lock file. While unlikely, this may indicate that a module has changed since last resolved against the BSR.
pkwarren
commented
Feb 28, 2023
| if err := bufmoduleref.PutDependencyModulePinsToBucket(ctx, readWriteBucket, dependencyModulePins); err != nil { | ||
| var inconsistentDigestErr bufmoduleref.InconsistentDigestError | ||
| if errors.As(err, &inconsistentDigestErr) { | ||
| return err |
Member
Author
There was a problem hiding this comment.
The mechanics of this can change, but what I'm trying to avoid here is printing out an error message that indicates it is an internal error that needs to be reported to Buf's issues page for a well known error.
twilly
reviewed
Feb 28, 2023
unmultimedio
approved these changes
Mar 1, 2023
Member
unmultimedio
left a comment
There was a problem hiding this comment.
Just nits, non blocking, nice work!
Comment on lines
+413
to
+415
| if _, err := manifest.NewDigestFromString(dep.Digest); err != nil { | ||
| continue | ||
| } |
Member
There was a problem hiding this comment.
Worth to log a warning about replacing an invalid digest?
Member
Author
There was a problem hiding this comment.
We could but I don't know what value it would have. I guess we could conceivably have really old lock files that still have a b3 digest in them, and replacing it shouldn't trigger warnings.
unmultimedio
approved these changes
Mar 1, 2023
unmultimedio
approved these changes
Mar 1, 2023
bufdev
reviewed
Mar 1, 2023
bufdev
approved these changes
Mar 1, 2023
Monirul1
pushed a commit
to Monirul1/buf
that referenced
this pull request
Apr 30, 2023
If 'buf mod update' runs and resolves to the same module identity and commit, it should error out if the digest doesn't match what is recorded in the buf.lock file. While unlikely, this may indicate that a module has changed since last resolved against the BSR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If 'buf mod update' runs and resolves to the same module identity and commit, it should error out if the digest doesn't match what is recorded in the buf.lock file. While unlikely, this may indicate that a module has changed since last resolved against the BSR.