diff --git a/src/Runner.Worker/JobExtension.cs b/src/Runner.Worker/JobExtension.cs index 58e1b1137..246274734 100644 --- a/src/Runner.Worker/JobExtension.cs +++ b/src/Runner.Worker/JobExtension.cs @@ -220,6 +220,11 @@ namespace GitHub.Runner.Worker { var networkAlias = pair.Key; var serviceContainer = pair.Value; + if (serviceContainer == null) + { + context.Output($"The service '{networkAlias}' will not be started because the container definition has an empty image."); + continue; + } jobContext.Global.ServiceContainers.Add(new Container.ContainerInfo(HostContext, serviceContainer, false, networkAlias)); } } diff --git a/src/Sdk/DTPipelines/Pipelines/ObjectTemplating/PipelineTemplateConverter.cs b/src/Sdk/DTPipelines/Pipelines/ObjectTemplating/PipelineTemplateConverter.cs index 69f9a3d32..506a7d268 100644 --- a/src/Sdk/DTPipelines/Pipelines/ObjectTemplating/PipelineTemplateConverter.cs +++ b/src/Sdk/DTPipelines/Pipelines/ObjectTemplating/PipelineTemplateConverter.cs @@ -316,7 +316,7 @@ namespace GitHub.DistributedTask.Pipelines.ObjectTemplating if (String.IsNullOrEmpty(result.Image)) { - context.Error(value, "Container image cannot be empty"); + return null; } return result; diff --git a/src/Sdk/DTPipelines/workflow-v1.0.json b/src/Sdk/DTPipelines/workflow-v1.0.json index 6ae301fbd..a3745029b 100644 --- a/src/Sdk/DTPipelines/workflow-v1.0.json +++ b/src/Sdk/DTPipelines/workflow-v1.0.json @@ -381,7 +381,7 @@ "container-mapping": { "mapping": { "properties": { - "image": "non-empty-string", + "image": "string", "options": "non-empty-string", "env": "container-env", "ports": "sequence-of-non-empty-string", @@ -414,7 +414,7 @@ "vars" ], "one-of": [ - "non-empty-string", + "string", "container-mapping" ] },