From d33c26a0e0ac180b504f2bd8c4274ac62b9f8190 Mon Sep 17 00:00:00 2001 From: Nirmalyasen Date: Mon, 21 Dec 2020 17:12:49 -0800 Subject: [PATCH 1/2] Most K8S deployments do not use the outputs in downstream stages. So, if it is not used users can skip the output of the Deployment Manifest and Run Job (Manifest) stage by specifiying the attribute noOutput set to false in the stage json. This significantly reduces the execution context being saved in redis/databse or sent to the browser. --- .../orca/clouddriver/pipeline/job/RunJobStage.java | 9 +++++++++ .../pipeline/manifest/DeployManifestStage.java | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/clouddriver/pipeline/job/RunJobStage.java b/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/clouddriver/pipeline/job/RunJobStage.java index 55e053802e..c5c0c97d8f 100644 --- a/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/clouddriver/pipeline/job/RunJobStage.java +++ b/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/clouddriver/pipeline/job/RunJobStage.java @@ -16,9 +16,12 @@ package com.netflix.spinnaker.orca.clouddriver.pipeline.job; +import static java.util.Collections.emptyMap; + import com.fasterxml.jackson.databind.ObjectMapper; import com.netflix.spinnaker.orca.api.pipeline.CancellableStage; import com.netflix.spinnaker.orca.api.pipeline.graph.StageDefinitionBuilder; +import com.netflix.spinnaker.orca.api.pipeline.graph.StageGraphBuilder; import com.netflix.spinnaker.orca.api.pipeline.graph.TaskNode; import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution; import com.netflix.spinnaker.orca.clouddriver.tasks.artifacts.ConsumeArtifactTask; @@ -76,6 +79,12 @@ public void taskGraph(@Nonnull StageExecution stage, @Nonnull TaskNode.Builder b } } + public void afterStages(@Nonnull StageExecution stage, @Nonnull StageGraphBuilder graph) { + if (stage.getContext().getOrDefault("noOutput", "false").toString().equals("true")) { + stage.setOutputs(emptyMap()); + } + } + @Override public Result cancel(StageExecution stage) { log.info( diff --git a/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/clouddriver/pipeline/manifest/DeployManifestStage.java b/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/clouddriver/pipeline/manifest/DeployManifestStage.java index 3c417329b4..798c6aefab 100644 --- a/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/clouddriver/pipeline/manifest/DeployManifestStage.java +++ b/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/clouddriver/pipeline/manifest/DeployManifestStage.java @@ -18,6 +18,7 @@ package com.netflix.spinnaker.orca.clouddriver.pipeline.manifest; import static com.google.common.collect.ImmutableList.toImmutableList; +import static java.util.Collections.emptyMap; import com.google.common.collect.ImmutableList; import com.netflix.spinnaker.orca.api.pipeline.graph.StageDefinitionBuilder; @@ -80,6 +81,9 @@ public void afterStages(@Nonnull StageExecution stage, @Nonnull StageGraphBuilde // do nothing } } + if (stage.getContext().getOrDefault("noOutput", "false").toString().equals("true")) { + stage.setOutputs(emptyMap()); + } } private void disableOldManifests(Map parentContext, StageGraphBuilder graph) { From 0d36ec9046320eec3583b0dee9e7d56d82853d8e Mon Sep 17 00:00:00 2001 From: Nirmalyasen Date: Mon, 21 Dec 2020 17:12:49 -0800 Subject: [PATCH 2/2] feat(kubernetes): attribue to explicitly skip the outputs section in Deployment Manifest or Run Job stage Most K8S deployments do not use the outputs in downstream stages. So, if it is not used users can skip the output of the Deployment Manifest and Run Job (Manifest) stage by specifiying the attribute noOutput set to false in the stage json. This significantly reduces the execution context being saved in redis/databse or sent to the browser. --- .../spinnaker/orca/clouddriver/pipeline/job/RunJobStage.java | 1 + 1 file changed, 1 insertion(+) diff --git a/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/clouddriver/pipeline/job/RunJobStage.java b/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/clouddriver/pipeline/job/RunJobStage.java index c5c0c97d8f..778c93ed87 100644 --- a/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/clouddriver/pipeline/job/RunJobStage.java +++ b/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/clouddriver/pipeline/job/RunJobStage.java @@ -79,6 +79,7 @@ public void taskGraph(@Nonnull StageExecution stage, @Nonnull TaskNode.Builder b } } + @Override public void afterStages(@Nonnull StageExecution stage, @Nonnull StageGraphBuilder graph) { if (stage.getContext().getOrDefault("noOutput", "false").toString().equals("true")) { stage.setOutputs(emptyMap());