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

Add error message for credentials not being sent over HTTP #613

Merged
merged 3 commits into from
Jul 13, 2018

Conversation

TadCordle
Copy link
Contributor

Part of #599

Copy link
Contributor

@coollog coollog left a comment

Choose a reason for hiding this comment

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

Nice!

@@ -108,6 +112,11 @@ public String forDockerNotInstalled() {
return suggest("make sure Docker is installed and you have correct privileges to run it");
}

public String forInsecureRegistry() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like the more useful message, but I don't see a reference to this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one was already here, just moved it because it was all the way at the bottom of the file. Is this actually more useful? I thought the problem happened even if you set allowInsecureRegistries.

Copy link
Member

Choose a reason for hiding this comment

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

It's called slightly further down in BuildStepRunner

Copy link
Contributor Author

@TadCordle TadCordle Jul 13, 2018

Choose a reason for hiding this comment

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

Yeah, I think that's the one that happens if allowInsecureRegistries isn't set and it tries to do an HTTP fallback. But the error we're throwing here is when HTTP fallback proceeds, but credentials are required (and not sent).

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah right, I should read more before commenting haha.

@@ -96,6 +96,10 @@ public String forCredentialsNotCorrect(String registry) {
return suggest("make sure your credentials for '" + registry + "' are set up correctly");
}

public String forCredentialsNotSent() {
return suggest("use a registry that supports HTTPS so credentials can be sent safely");
Copy link
Contributor

Choose a reason for hiding this comment

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

I think prefixing with an explanation before the suggestion would be good. Something along the lines of:

The registry requires credentials but credentials were not sent because the connection was over HTTP.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm should that prefix go in the new exception instead of HelpfulSuggestions, or is it too specific for that?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, good catch, it should go in the new exception instead.

@TadCordle TadCordle merged commit cfdc014 into master Jul 13, 2018
@TadCordle TadCordle deleted the creds-over-http-error branch July 13, 2018 21:49
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.

3 participants