-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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"); | ||
} | ||
|
||
public String forDockerContextInsecureRecursiveDelete(String directory) { | ||
return suggest("clear " + directory + " manually before creating the Docker context"); | ||
} | ||
|
@@ -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() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's called slightly further down in BuildStepRunner There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I think that's the one that happens if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah right, I should read more before commenting haha. |
||
return suggest( | ||
"use a registry that supports HTTPS or set the configuration parameter 'allowInsecureRegistries'"); | ||
} | ||
|
||
/** | ||
* @param parameter the parameter name (e.g. 'to.image' or {@literal <to><image>}) | ||
* @param buildConfigFilename the name of the build config (build.gradle or pom.xml) | ||
|
@@ -145,9 +154,4 @@ private String forNoCredentialHelpersDefined( | |
+ "' or " | ||
+ authConfiguration); | ||
} | ||
|
||
public String forInsecureRegistry() { | ||
return suggest( | ||
"use a registry that supports HTTPS or set the configuration parameter 'allowInsecureRegistries'"); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2018 Google LLC. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package com.google.cloud.tools.jib.registry; | ||
|
||
/** Thrown when registry request was unauthorized because credentials weren't sent. */ | ||
public class RegistryCredentialsNotSentException extends RegistryException { | ||
|
||
/** | ||
* Identifies the image registry and repository that denied access. | ||
* | ||
* @param registry the image registry | ||
* @param repository the image repository | ||
*/ | ||
RegistryCredentialsNotSentException(String registry, String repository) { | ||
super("Credentials for " + registry + "/" + repository + " were not sent"); | ||
} | ||
} |
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 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.
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.
Hmm should that prefix go in the new exception instead of
HelpfulSuggestions
, or is it too specific for that?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.
Yep, good catch, it should go in the new exception instead.