mirror of
https://github.com/actions/runner.git
synced 2025-12-10 20:36:49 +00:00
delete un-used code. (#218)
This commit is contained in:
@@ -46,170 +46,6 @@ namespace GitHub.DistributedTask.Pipelines.ObjectTemplating
|
||||
|
||||
public Int32 MaxResultSize { get; set; } = 10 * 1024 * 1024; // 10 mb
|
||||
|
||||
public StrategyResult EvaluateStrategy(
|
||||
TemplateToken token,
|
||||
DictionaryContextData contextData,
|
||||
String jobFactoryDisplayName)
|
||||
{
|
||||
var result = new StrategyResult();
|
||||
|
||||
if (token != null && token.Type != TokenType.Null)
|
||||
{
|
||||
var context = CreateContext(contextData);
|
||||
try
|
||||
{
|
||||
token = TemplateEvaluator.Evaluate(context, PipelineTemplateConstants.Strategy, token, 0, null, omitHeader: true);
|
||||
context.Errors.Check();
|
||||
result = PipelineTemplateConverter.ConvertToStrategy(context, token, jobFactoryDisplayName);
|
||||
}
|
||||
catch (Exception ex) when (!(ex is TemplateValidationException))
|
||||
{
|
||||
context.Errors.Add(ex);
|
||||
}
|
||||
|
||||
context.Errors.Check();
|
||||
}
|
||||
|
||||
if (result.Configurations.Count == 0)
|
||||
{
|
||||
var configuration = new StrategyConfiguration
|
||||
{
|
||||
Name = PipelineConstants.DefaultJobName,
|
||||
DisplayName = new JobDisplayNameBuilder(jobFactoryDisplayName).Build(),
|
||||
};
|
||||
configuration.ContextData.Add(PipelineTemplateConstants.Matrix, null);
|
||||
configuration.ContextData.Add(
|
||||
PipelineTemplateConstants.Strategy,
|
||||
new DictionaryContextData
|
||||
{
|
||||
{
|
||||
"fail-fast",
|
||||
new BooleanContextData(result.FailFast)
|
||||
},
|
||||
{
|
||||
"job-index",
|
||||
new NumberContextData(0)
|
||||
},
|
||||
{
|
||||
"job-total",
|
||||
new NumberContextData(1)
|
||||
},
|
||||
{
|
||||
"max-parallel",
|
||||
new NumberContextData(1)
|
||||
}
|
||||
});
|
||||
result.Configurations.Add(configuration);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public String EvaluateJobDisplayName(
|
||||
TemplateToken token,
|
||||
DictionaryContextData contextData,
|
||||
String defaultDisplayName)
|
||||
{
|
||||
var result = default(String);
|
||||
|
||||
if (token != null && token.Type != TokenType.Null)
|
||||
{
|
||||
var context = CreateContext(contextData);
|
||||
try
|
||||
{
|
||||
token = TemplateEvaluator.Evaluate(context, PipelineTemplateConstants.StringStrategyContext, token, 0, null, omitHeader: true);
|
||||
context.Errors.Check();
|
||||
result = PipelineTemplateConverter.ConvertToJobDisplayName(context, token);
|
||||
}
|
||||
catch (Exception ex) when (!(ex is TemplateValidationException))
|
||||
{
|
||||
context.Errors.Add(ex);
|
||||
}
|
||||
|
||||
context.Errors.Check();
|
||||
}
|
||||
|
||||
return !String.IsNullOrEmpty(result) ? result : defaultDisplayName;
|
||||
}
|
||||
|
||||
public PhaseTarget EvaluateJobTarget(
|
||||
TemplateToken token,
|
||||
DictionaryContextData contextData)
|
||||
{
|
||||
var result = default(PhaseTarget);
|
||||
|
||||
if (token != null && token.Type != TokenType.Null)
|
||||
{
|
||||
var context = CreateContext(contextData);
|
||||
try
|
||||
{
|
||||
token = TemplateEvaluator.Evaluate(context, PipelineTemplateConstants.RunsOn, token, 0, null, omitHeader: true);
|
||||
context.Errors.Check();
|
||||
result = PipelineTemplateConverter.ConvertToJobTarget(context, token);
|
||||
}
|
||||
catch (Exception ex) when (!(ex is TemplateValidationException))
|
||||
{
|
||||
context.Errors.Add(ex);
|
||||
}
|
||||
|
||||
context.Errors.Check();
|
||||
}
|
||||
|
||||
return result ?? throw new InvalidOperationException("Job target cannot be null");
|
||||
}
|
||||
|
||||
public Int32 EvaluateJobTimeout(
|
||||
TemplateToken token,
|
||||
DictionaryContextData contextData)
|
||||
{
|
||||
var result = default(Int32?);
|
||||
|
||||
if (token != null && token.Type != TokenType.Null)
|
||||
{
|
||||
var context = CreateContext(contextData);
|
||||
try
|
||||
{
|
||||
token = TemplateEvaluator.Evaluate(context, PipelineTemplateConstants.NumberStrategyContext, token, 0, null, omitHeader: true);
|
||||
context.Errors.Check();
|
||||
result = PipelineTemplateConverter.ConvertToJobTimeout(context, token);
|
||||
}
|
||||
catch (Exception ex) when (!(ex is TemplateValidationException))
|
||||
{
|
||||
context.Errors.Add(ex);
|
||||
}
|
||||
|
||||
context.Errors.Check();
|
||||
}
|
||||
|
||||
return result ?? PipelineConstants.DefaultJobTimeoutInMinutes;
|
||||
}
|
||||
|
||||
public Int32 EvaluateJobCancelTimeout(
|
||||
TemplateToken token,
|
||||
DictionaryContextData contextData)
|
||||
{
|
||||
var result = default(Int32?);
|
||||
|
||||
if (token != null && token.Type != TokenType.Null)
|
||||
{
|
||||
var context = CreateContext(contextData);
|
||||
try
|
||||
{
|
||||
token = TemplateEvaluator.Evaluate(context, PipelineTemplateConstants.NumberStrategyContext, token, 0, null, omitHeader: true);
|
||||
context.Errors.Check();
|
||||
result = PipelineTemplateConverter.ConvertToJobCancelTimeout(context, token);
|
||||
}
|
||||
catch (Exception ex) when (!(ex is TemplateValidationException))
|
||||
{
|
||||
context.Errors.Add(ex);
|
||||
}
|
||||
|
||||
context.Errors.Check();
|
||||
}
|
||||
|
||||
return result ?? PipelineConstants.DefaultJobCancelTimeoutInMinutes;
|
||||
}
|
||||
|
||||
public DictionaryContextData EvaluateStepScopeInputs(
|
||||
TemplateToken token,
|
||||
DictionaryContextData contextData)
|
||||
|
||||
Reference in New Issue
Block a user