From a727194742dd7b28c265527f71e2a3669b71516a Mon Sep 17 00:00:00 2001 From: eric sciple Date: Sun, 12 Jan 2020 23:02:36 -0500 Subject: [PATCH] allow container to be null/empty (#266) --- .../PipelineTemplateConverter.cs | 5 +++++ src/Sdk/DTPipelines/workflow-v1.0.json | 16 ++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Sdk/DTPipelines/Pipelines/ObjectTemplating/PipelineTemplateConverter.cs b/src/Sdk/DTPipelines/Pipelines/ObjectTemplating/PipelineTemplateConverter.cs index e76c08aa6..951d0869f 100644 --- a/src/Sdk/DTPipelines/Pipelines/ObjectTemplating/PipelineTemplateConverter.cs +++ b/src/Sdk/DTPipelines/Pipelines/ObjectTemplating/PipelineTemplateConverter.cs @@ -154,6 +154,11 @@ namespace GitHub.DistributedTask.Pipelines.ObjectTemplating if (value is StringToken containerLiteral) { + if (String.IsNullOrEmpty(containerLiteral.Value)) + { + return null; + } + result.Image = containerLiteral.Value; } else diff --git a/src/Sdk/DTPipelines/workflow-v1.0.json b/src/Sdk/DTPipelines/workflow-v1.0.json index 02741c871..21e6d2b63 100644 --- a/src/Sdk/DTPipelines/workflow-v1.0.json +++ b/src/Sdk/DTPipelines/workflow-v1.0.json @@ -472,7 +472,7 @@ "matrix" ], "one-of": [ - "non-empty-string", + "string", "container-mapping" ] }, @@ -497,10 +497,22 @@ ], "mapping": { "loose-key-type": "non-empty-string", - "loose-value-type": "container" + "loose-value-type": "services-container" } }, + "services-container": { + "context": [ + "github", + "strategy", + "matrix" + ], + "one-of": [ + "non-empty-string", + "container-mapping" + ] + }, + "container-env": { "mapping": { "loose-key-type": "non-empty-string",