fix(kubernetes): add cleaned up artifact manifests to output
MODIFY
clouddriver-kubernetes/src/main/groovy/com/netflix/spinnaker/clouddriver/kubernetes/v2/op/artifact/KubernetesCleanupArtifactsOperation.java
clouddriver-kubernetes/src/main/groovy/com/netflix/spinnaker/clouddriver/kubernetes/v2/op/artifact/KubernetesCleanupArtifactsOperation.java
@@ -26,6 +26,7 @@ import com.netflix.spinnaker.clouddriver.kubernetes.v2.description.manifest.Kube
import com.netflix.spinnaker.clouddriver.kubernetes.v2.description.manifest.KubernetesManifest;
import com.netflix.spinnaker.clouddriver.kubernetes.v2.description.manifest.KubernetesManifestAnnotater;
import com.netflix.spinnaker.clouddriver.kubernetes.v2.description.manifest.KubernetesManifestStrategy;
+import com.netflix.spinnaker.clouddriver.kubernetes.v2.op.OperationResult;
import com.netflix.spinnaker.clouddriver.kubernetes.v2.op.handler.KubernetesHandler;
import com.netflix.spinnaker.clouddriver.kubernetes.v2.security.KubernetesV2Credentials;
import com.netflix.spinnaker.clouddriver.model.ArtifactProvider;
@@ -41,7 +42,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
@Slf4j
-public class KubernetesCleanupArtifactsOperation implements AtomicOperation<Void> {
+public class KubernetesCleanupArtifactsOperation implements AtomicOperation<OperationResult> {
private final KubernetesCleanupArtifactsDescription description;
private final KubernetesV2Credentials credentials;
private final String accountName;
@@ -65,7 +66,9 @@ public class KubernetesCleanupArtifactsOperation implements AtomicOperation<Void
}
@Override
- public Void operate(List priorOutputs) {
+ public OperationResult operate(List priorOutputs) {
+ OperationResult result = new OperationResult();
+
List<Artifact> artifacts =
description.getManifests().stream()
.map(this::artifactsToDelete)
@@ -93,11 +96,12 @@ public class KubernetesCleanupArtifactsOperation implements AtomicOperation<Void
if (StringUtils.isNotEmpty(a.getVersion())) {
name = String.join("-", name, a.getVersion());
}
- // todo add to outputs
- handler.delete(credentials, a.getLocation(), name, null, new V1DeleteOptions());
+ result.merge(
+ handler.delete(credentials, a.getLocation(), name, null, new V1DeleteOptions()));
});
- return null;
+ result.setManifests(null);
+ return result;
}
private List<Artifact> artifactsToDelete(KubernetesManifest manifest) {

fix(kubernetes): add cleaned up artifact manifests to output (#3711)