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
Make NormalizeLocalName to not reach the network to normalize names. #18014
Conversation
f5e895a
to
3d4255c
Compare
return name | ||
} | ||
|
||
var oficialIndex bool |
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.
officialIndex
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.
we're in Barcelona, it's oficial
😝
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.
fixed, thanks.
3d4255c
to
757d812
Compare
757d812
to
1c55be9
Compare
func NormalizeLocalName(name string) string { | ||
repoInfo, err := ParseRepositoryInfo(name) | ||
indexName, remoteName := splitReposName(name) |
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.
Should there be a call to validateNoSchema
to match the old behavior?
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 feel like I left it out for some reason. But I don't think it can harm. I've changed the code a little bit to reuse a validate function that we already implemented with the checks we need.
😭 |
870aae2
to
3396742
Compare
Should |
|
||
// normalizeLibraryRepoName removes the library prefix from | ||
// the repository name for official repos. | ||
func normalizeLibraryRepoName(name string) string { |
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.
normalizeLibraryRepoName can be used in NewRepositoryInfo.
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.
it's already used there.
LGTM |
3396742
to
4277ee0
Compare
@aaronlehmann, @anusha-ragunathan I've removed that duplicated code. Please, take a look. |
var err error | ||
if err = validateNoSchema(reposName); err != nil { | ||
return err | ||
_, _, err := loadRepositoryName(reposName, true) |
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.
Nit: ValidateRepositoryName is now a thin wrapper over loadRepositoryName. Given that, its better to give them similar names for better readability.
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.
loadRepositoryName
is correct. I rather not change calls to ValidateRepositoryName
in this patch.
4277ee0
to
d77f23c
Compare
@@ -302,34 +315,22 @@ func splitReposName(reposName string) (string, string) { | |||
|
|||
// NewRepositoryInfo validates and breaks down a repository name into a RepositoryInfo | |||
func (config *ServiceConfig) NewRepositoryInfo(reposName string, bySearch bool) (*RepositoryInfo, 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.
Nit: For the sake of code reuse/readability, is it possible to restructure NewRepositoryInfo to take a bool arg? This arg would indicate call from NormalizeLocalName. There are only 3 callers for NewRepositoryInfo, so changing the function signature would be okay. Meanwhile, in NewRepositoryInfo, since most of the code that we need is here, we can use the bool flag to navigate our way around NewIndexInfo (which causes the network lookup).
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.
Not here. I rather minimize the changes we need for the patch release. That's not necessary to fix the bug.
Can we also fix the |
Signed-off-by: David Calavera <david.calavera@gmail.com>
d77f23c
to
b665730
Compare
@tonistiigi I rather make the less changes necessaries as possible to fix the ps behavior. I agree that we should fix that |
@tonistiigi @anusha-ragunathan @aaronlehmann let's keep it small for 1.9.1 and merge it now if there is no significant problems. |
LGTM Although, I don't get the comment about simplicity. |
LGTM I agree about not making bigger changes here. This code changes a lot in #17924, so it will be easier to make additional changes after that PR is merged. |
LGTM |
Make NormalizeLocalName to not reach the network to normalize names.
Okay, looks like 4 LGTMs is enough |
Fixes #18003
Signed-off-by: David Calavera david.calavera@gmail.com