diff --git a/java-components/adhoc-analyser-tool/src/main/java/com/redhat/hacbs/analyser/kube/ResetArtifactBuildsCommand.java b/java-components/adhoc-analyser-tool/src/main/java/com/redhat/hacbs/analyser/kube/ResetArtifactBuildsCommand.java index 737badad2..d37e96170 100644 --- a/java-components/adhoc-analyser-tool/src/main/java/com/redhat/hacbs/analyser/kube/ResetArtifactBuildsCommand.java +++ b/java-components/adhoc-analyser-tool/src/main/java/com/redhat/hacbs/analyser/kube/ResetArtifactBuildsCommand.java @@ -10,6 +10,7 @@ import io.fabric8.kubernetes.api.model.KubernetesResourceList; import io.fabric8.kubernetes.client.KubernetesClient; import io.fabric8.kubernetes.client.dsl.MixedOperation; +import io.fabric8.kubernetes.client.dsl.NonDeletingOperation; import io.fabric8.kubernetes.client.dsl.Resource; import io.quarkus.logging.Log; import picocli.CommandLine; @@ -34,13 +35,13 @@ public void run() { if (!build.isEmpty()) { ArtifactBuild request = client.withName(build).get(); request.getMetadata().setAnnotations(Map.of("jvmbuildservice.io/rebuild", "true")); - client.createOrReplace(request); + client.resource(request).unlock().createOr(NonDeletingOperation::update); } else { List items = client.list().getItems(); for (var request : items) { if (!missing || request.getStatus().getState().equals("ArtifactBuildMissing")) { request.getMetadata().setAnnotations(Map.of("jvmbuildservice.io/rebuild", "true")); - client.createOrReplace(request); + client.resource(request).unlock().createOr(NonDeletingOperation::update); } } } diff --git a/java-components/adhoc-analyser-tool/src/main/java/com/redhat/hacbs/analyser/kube/ResetDependencyBuildsCommand.java b/java-components/adhoc-analyser-tool/src/main/java/com/redhat/hacbs/analyser/kube/ResetDependencyBuildsCommand.java index 8a735e139..12e069c42 100644 --- a/java-components/adhoc-analyser-tool/src/main/java/com/redhat/hacbs/analyser/kube/ResetDependencyBuildsCommand.java +++ b/java-components/adhoc-analyser-tool/src/main/java/com/redhat/hacbs/analyser/kube/ResetDependencyBuildsCommand.java @@ -33,14 +33,14 @@ public void run() { DependencyBuild item = client.withName(build).get(); item.getStatus().setState(""); // item.getStatus().setFailedBuildRecipes(Collections.emptyList()); - client.updateStatus(item); + client.resource(item).updateStatus(); } else { List items = client.list().getItems(); for (var request : items) { if (!failedOnly || request.getStatus().getState().equals("DependencyBuildStateFailed")) { request.getStatus().setState(""); // request.getStatus().setFailedBuildRecipes(Collections.emptyList()); - client.updateStatus(request); + client.resource(request).updateStatus(); } } }