diff --git a/rosco-manifests/src/main/java/com/netflix/spinnaker/rosco/manifests/BakeManifestRequest.java b/rosco-manifests/src/main/java/com/netflix/spinnaker/rosco/manifests/BakeManifestRequest.java index 6a1eb36c8..783569bfe 100644 --- a/rosco-manifests/src/main/java/com/netflix/spinnaker/rosco/manifests/BakeManifestRequest.java +++ b/rosco-manifests/src/main/java/com/netflix/spinnaker/rosco/manifests/BakeManifestRequest.java @@ -10,7 +10,7 @@ public class BakeManifestRequest { TemplateRenderer templateRenderer; String outputName; String outputArtifactName; - Map overrides; + @Nullable Map overrides; public enum TemplateRenderer { HELM2, diff --git a/rosco-manifests/src/main/java/com/netflix/spinnaker/rosco/manifests/helm/HelmTemplateUtils.java b/rosco-manifests/src/main/java/com/netflix/spinnaker/rosco/manifests/helm/HelmTemplateUtils.java index f0d74e943..4c6f4594b 100644 --- a/rosco-manifests/src/main/java/com/netflix/spinnaker/rosco/manifests/helm/HelmTemplateUtils.java +++ b/rosco-manifests/src/main/java/com/netflix/spinnaker/rosco/manifests/helm/HelmTemplateUtils.java @@ -89,7 +89,7 @@ public BakeRecipe buildCommand( } Map overrides = request.getOverrides(); - if (!overrides.isEmpty()) { + if (overrides != null && !overrides.isEmpty()) { List overrideList = new ArrayList<>(); for (Map.Entry entry : overrides.entrySet()) { overrideList.add(entry.getKey() + "=" + entry.getValue().toString()); diff --git a/rosco-manifests/src/test/java/com/netflix/spinnaker/rosco/manifests/helm/HelmTemplateUtilsTest.java b/rosco-manifests/src/test/java/com/netflix/spinnaker/rosco/manifests/helm/HelmTemplateUtilsTest.java index 1a6eb41e9..b6ada5fcf 100644 --- a/rosco-manifests/src/test/java/com/netflix/spinnaker/rosco/manifests/helm/HelmTemplateUtilsTest.java +++ b/rosco-manifests/src/test/java/com/netflix/spinnaker/rosco/manifests/helm/HelmTemplateUtilsTest.java @@ -93,6 +93,15 @@ public void nullReferenceTest() throws IOException { } } + @Test + public void realNullReferenceOfOverrides() throws IOException { + bakeManifestRequest.setOverrides(null); + + try (BakeManifestEnvironment env = BakeManifestEnvironment.create()) { + BakeRecipe recipe = helmTemplateUtils.buildBakeRecipe(env, bakeManifestRequest); + } + } + public void exceptionDownloading() throws IOException { // When artifactDownloader throws an exception, make sure we wrap it and get // a chance to include our own message, so the exception that goes up the