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

Fixed #1769 Suggest to rename the image name #2245

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@
void process(ImageConfiguration imageConfiguration) throws JKubeServiceException;
}

protected String getHintFromException(Exception ex) {
String message = "Error while trying to push the image: " + ex.getMessage();

Check warning on line 50 in jkube-kit/config/service/src/main/java/org/eclipse/jkube/kit/config/service/AbstractImageBuildService.java

View check run for this annotation

Codecov / codecov/patch

jkube-kit/config/service/src/main/java/org/eclipse/jkube/kit/config/service/AbstractImageBuildService.java#L50

Added line #L50 was not covered by tests
if(ex.getMessage().contains("denied") || ex.getMessage().contains("unauthorized")) {
message += "\nPossible issues: invalid credentials or incorrect image name or registry." +

Check warning on line 52 in jkube-kit/config/service/src/main/java/org/eclipse/jkube/kit/config/service/AbstractImageBuildService.java

View check run for this annotation

Codecov / codecov/patch

jkube-kit/config/service/src/main/java/org/eclipse/jkube/kit/config/service/AbstractImageBuildService.java#L52

Added line #L52 was not covered by tests
"\nHint: Check your credentials." +
"\nHint: Image name can be modified with the jkube.generator.name property";
}
return message;

Check warning on line 56 in jkube-kit/config/service/src/main/java/org/eclipse/jkube/kit/config/service/AbstractImageBuildService.java

View check run for this annotation

Codecov / codecov/patch

jkube-kit/config/service/src/main/java/org/eclipse/jkube/kit/config/service/AbstractImageBuildService.java#L56

Added line #L56 was not covered by tests
}

private void processImage(ImageConfigurationProcessor imageConfigurationConsumer, String skipMessage, ImageConfiguration... imageConfigurations) throws JKubeServiceException {
if (imageConfigurations != null) {
for (ImageConfiguration imageConfiguration : imageConfigurations) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
try {
dockerServices.getRegistryService().pushImage(imageConfiguration, retries, registryConfig, skipTag);
} catch (IOException ex) {
throw new JKubeServiceException("Error while trying to push the image: " + ex.getMessage(), ex);
throw new JKubeServiceException(getHintFromException(ex), ex);

Check warning on line 73 in jkube-kit/config/service/src/main/java/org/eclipse/jkube/kit/config/service/kubernetes/DockerBuildService.java

View check run for this annotation

Codecov / codecov/patch

jkube-kit/config/service/src/main/java/org/eclipse/jkube/kit/config/service/kubernetes/DockerBuildService.java#L73

Added line #L73 was not covered by tests
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
log
);
} catch (Exception ex) {
throw new JKubeServiceException("Error when push JIB image", ex);
throw new JKubeServiceException(getHintFromException(ex), ex);

Check warning on line 119 in jkube-kit/config/service/src/main/java/org/eclipse/jkube/kit/config/service/kubernetes/JibBuildService.java

View check run for this annotation

Codecov / codecov/patch

jkube-kit/config/service/src/main/java/org/eclipse/jkube/kit/config/service/kubernetes/JibBuildService.java#L119

Added line #L119 was not covered by tests
}
}

Expand Down
Loading