mirror of
https://github.com/actions/runner.git
synced 2025-12-12 15:13:30 +00:00
Allow the container.image to be empty (#2235)
* Allow container.image to be null/empty * Remove unnecessary workflow type * Update src/Sdk/DTPipelines/Pipelines/ObjectTemplating/PipelineTemplateConverter.cs Co-authored-by: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> * Rename ConvertToJobContainer to ConvertToContainer It converts serviceContainers too * Remove unused parameter AllowExpressions was always false * Allow service in yaml with empty string for value * Don't attempt to start services without an image * Improve error messages * Revert "Remove unused parameter" This reverts commitf4ab2d50d0. * Revert "Rename ConvertToJobContainer to ConvertToContainer" This reverts commitffc62f8343. * Fix revert merge conflict * Removed info logs * Added info log for services without container images Co-authored-by: moonblade <moonblade168@gmail.com> Co-authored-by: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Co-authored-by: Ava Stancu <avastancu@github.com>
This commit is contained in:
@@ -220,6 +220,11 @@ namespace GitHub.Runner.Worker
|
|||||||
{
|
{
|
||||||
var networkAlias = pair.Key;
|
var networkAlias = pair.Key;
|
||||||
var serviceContainer = pair.Value;
|
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));
|
jobContext.Global.ServiceContainers.Add(new Container.ContainerInfo(HostContext, serviceContainer, false, networkAlias));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ namespace GitHub.DistributedTask.Pipelines.ObjectTemplating
|
|||||||
|
|
||||||
if (String.IsNullOrEmpty(result.Image))
|
if (String.IsNullOrEmpty(result.Image))
|
||||||
{
|
{
|
||||||
context.Error(value, "Container image cannot be empty");
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -381,7 +381,7 @@
|
|||||||
"container-mapping": {
|
"container-mapping": {
|
||||||
"mapping": {
|
"mapping": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"image": "non-empty-string",
|
"image": "string",
|
||||||
"options": "non-empty-string",
|
"options": "non-empty-string",
|
||||||
"env": "container-env",
|
"env": "container-env",
|
||||||
"ports": "sequence-of-non-empty-string",
|
"ports": "sequence-of-non-empty-string",
|
||||||
@@ -414,7 +414,7 @@
|
|||||||
"vars"
|
"vars"
|
||||||
],
|
],
|
||||||
"one-of": [
|
"one-of": [
|
||||||
"non-empty-string",
|
"string",
|
||||||
"container-mapping"
|
"container-mapping"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user