-
Notifications
You must be signed in to change notification settings - Fork 187
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
libgit2: improve known_hosts error messages #783
Conversation
knownHosts: []byte(knownHostsFixtureUnormalized), | ||
hostkey: git2go.HostkeyCertificate{Kind: git2go.HostkeySHA256, HashSHA256: sha256Fingerprint("AGvEpqYNMqsRNIviwyk4J4HM0lEylomDBKOWZsBn434")}, | ||
expectedHost: "source.developers.google.com:2022", | ||
want: fmt.Errorf("no entries in known_hosts matches host '[source.developers.google.com]:2022' with fingerprint 'AGvEpqYNMqsRNIviwyk4J4HM0lEylomDBKOWZsBn434='"), |
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.
Pointing this out just to highlight how this looks like when printing the fingerprint in the error, so that we can discuss and think if there's a better way to express this error.
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.
This is what it looks like in the GitRepo object status:
status:
conditions:
- lastTransitionTime: "2022-06-14T15:42:46Z"
message: no artifact for resource in storage
observedGeneration: 1
reason: NoArtifact
status: "True"
type: Reconciling
- lastTransitionTime: "2022-06-14T15:42:47Z"
message: 'failed to checkout and determine revision: unable to fetch-connect to
remote ''ssh://git@example.com:2224/foo/bar.git'':
ssh: handshake failed: no entries in known_hosts matches host ''[example.com]:2224''
with fingerprint ''AGvEpqYNMqsRNIviwyk4J4HM0lEylomDBKOWZsBn434='''
observedGeneration: 1
reason: GitOperationFailed
status: "False"
type: Ready
- lastTransitionTime: "2022-06-14T15:42:47Z"
message: 'failed to checkout and determine revision: unable to fetch-connect to
remote ''ssh://git@example.com:2224/foo/bar.git'':
ssh: handshake failed: no entries in known_hosts matches host ''[example.com]:2224''
with fingerprint ''AGvEpqYNMqsRNIviwyk4J4HM0lEylomDBKOWZsBn434='''
observedGeneration: 1
reason: GitOperationFailed
status: "True"
type: FetchFailed
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.
Small point here, based on @aryan9600's suggestion, we will no longer add padding to the fingerprints.
1addcd0
to
494bfc2
Compare
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.
LGTM! 💯
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.
The overall change looks good to me. It'll make it much easier to debug the next time I use a non-standard port.
If we are fine with the error message that it'd put on the GitRepo status with fingerprint string, I'm good with merging this.
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.
LGTM
Thanks @pjbgf
Known hosts can be a difficult problem to troubleshoot. To make it easier for end users, the generic message has now been changed with a much more user friendly one. Now if a known_host is not set, an error message will be returned, instead of it simply being ignored. Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
494bfc2
to
b490a6a
Compare
Rebased. |
Known hosts can be a difficult problem to troubleshoot.
To make it easier for end users, the generic message has
now been changed with a much more user friendly one.
Now if a known_host is not set, an error message will be
returned, instead of it simply being ignored.