Skip to content

Commit

Permalink
Fix for container build, function update
Browse files Browse the repository at this point in the history
  • Loading branch information
kazhamiakin committed May 3, 2024
1 parent 81ea99d commit 31f299a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,12 @@ public V1Job build(K8sKanikoRunnable runnable) throws K8sFrameworkException {
String prefix =
(StringUtils.hasText(imageRegistry) ? imageRegistry + "/" : "") +
(StringUtils.hasText(imagePrefix) ? imagePrefix + "-" : "");
String imageName = k8sBuilderHelper.getImageName(prefix + runnable.getImage(), runnable.getId());
runnable.setImage(imageName);
// workaround: update image name only first time
String imageName = runnable.getImage();
if (StringUtils.hasText(prefix) && !runnable.getImage().startsWith(prefix)) {
imageName = k8sBuilderHelper.getImageName(prefix + runnable.getImage(), runnable.getId());
runnable.setImage(imageName);
}

//build labels
Map<String, String> labels = buildLabels(runnable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@ public RunContainerStatus onComplete(Run run, RunRunnable runnable) {
FunctionContainerSpec funSpec = new FunctionContainerSpec(function.getSpec());
if (!image.equals(funSpec.getImage())) {
funSpec.setImage(image);
functionService.updateFunction(functionId, function);
function.setSpec(funSpec.toMap());
functionService.updateFunction(functionId, function, true);
}
}

Expand Down

0 comments on commit 31f299a

Please sign in to comment.