Skip to content

Commit 7606855

Browse files
author
cgw
committed
解决构建版本上传镜像失败的问题
1 parent 3876e9b commit 7606855

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

dhorse-application/src/main/java/org/dhorse/application/service/DeployApplicationService.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -626,11 +626,21 @@ private boolean buildNodeImage(DeployContext context) {
626626
return true;
627627
}
628628

629-
private void doBuildImage(DeployContext context, String baseImage, List<String> entrypoint, List<Path> targetFiles) {
629+
private void doBuildImage(DeployContext context, String baseImageName, List<String> entrypoint, List<Path> targetFiles) {
630+
String imageUrl = context.getGlobalConfigAgg().getImageRepo().getUrl();
631+
String imageServer = imageUrl.substring(imageUrl.indexOf("//") + 2);
632+
630633
//设置连接仓库的超时时间
631634
System.setProperty("jib.httpTimeout", "15000");
632635
System.setProperty("sendCredentialsOverHttp", "true");
633636
try {
637+
RegistryImage baseImage = RegistryImage.named(baseImageName);
638+
if(baseImageName.startsWith(imageServer)) {
639+
baseImage.addCredential(
640+
context.getGlobalConfigAgg().getImageRepo().getAuthName(),
641+
context.getGlobalConfigAgg().getImageRepo().getAuthPassword());
642+
}
643+
634644
RegistryImage registryImage = RegistryImage.named(context.getFullNameOfImage()).addCredential(
635645
context.getGlobalConfigAgg().getImageRepo().getAuthName(),
636646
context.getGlobalConfigAgg().getImageRepo().getAuthPassword());

0 commit comments

Comments
 (0)