Skip to content

Commit a22fcbc

Browse files
committed
Revert "Add safety check to prevent from checking defaults in ScriptHandler for composite action"
This reverts commit aeae15d.
1 parent aeae15d commit a22fcbc

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

src/Runner.Worker/ExecutionContext.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,10 @@ public interface IExecutionContext : IRunnerService
6060

6161
bool EchoOnActionCommand { get; set; }
6262

63-
bool IsComposite { get; }
64-
6563
// Initialize
6664
void InitializeJob(Pipelines.AgentJobRequestMessage message, CancellationToken token);
6765
void CancelToken();
68-
IExecutionContext CreateChild(Guid recordId, string displayName, string refName, string scopeName, string contextName, Dictionary<string, string> intraActionState = null, int? recordOrder = null, IPagingLogger logger = null, bool isComposite = false);
66+
IExecutionContext CreateChild(Guid recordId, string displayName, string refName, string scopeName, string contextName, Dictionary<string, string> intraActionState = null, int? recordOrder = null, IPagingLogger logger = null);
6967

7068
// logging
7169
long Write(string tag, string message);
@@ -128,7 +126,6 @@ public sealed class ExecutionContext : RunnerService, IExecutionContext
128126
// only job level ExecutionContext will track throttling delay.
129127
private long _totalThrottlingDelayInMilliseconds = 0;
130128

131-
132129
public Guid Id => _record.Id;
133130
public string ScopeName { get; private set; }
134131
public string ContextName { get; private set; }
@@ -151,8 +148,6 @@ public sealed class ExecutionContext : RunnerService, IExecutionContext
151148
// Only job level ExecutionContext has StepsWithPostRegistered
152149
public HashSet<Guid> StepsWithPostRegistered { get; private set; }
153150

154-
public bool IsComposite { get; private set; }
155-
156151
public bool EchoOnActionCommand { get; set; }
157152

158153
public TaskResult? Result
@@ -259,7 +254,7 @@ public IStep CreateCompositeStep(
259254
DictionaryContextData inputsData,
260255
Dictionary<string, string> envData)
261256
{
262-
step.ExecutionContext = Root.CreateChild(_record.Id, step.DisplayName, _record.Id.ToString("N"), scopeName, step.Action.ContextName, logger: _logger, isComposite: true);
257+
step.ExecutionContext = Root.CreateChild(_record.Id, step.DisplayName, _record.Id.ToString("N"), scopeName, step.Action.ContextName, logger: _logger);
263258
step.ExecutionContext.ExpressionValues["inputs"] = inputsData;
264259
step.ExecutionContext.ExpressionValues["steps"] = Global.StepsContext.GetScope(step.ExecutionContext.GetFullyQualifiedContextName());
265260

@@ -278,7 +273,7 @@ public IStep CreateCompositeStep(
278273
return step;
279274
}
280275

281-
public IExecutionContext CreateChild(Guid recordId, string displayName, string refName, string scopeName, string contextName, Dictionary<string, string> intraActionState = null, int? recordOrder = null, IPagingLogger logger = null, bool isComposite = false)
276+
public IExecutionContext CreateChild(Guid recordId, string displayName, string refName, string scopeName, string contextName, Dictionary<string, string> intraActionState = null, int? recordOrder = null, IPagingLogger logger = null)
282277
{
283278
Trace.Entering();
284279

@@ -325,8 +320,6 @@ public IExecutionContext CreateChild(Guid recordId, string displayName, string r
325320
child._logger.Setup(_mainTimelineId, recordId);
326321
}
327322

328-
child.IsComposite = isComposite;
329-
330323
return child;
331324
}
332325

src/Runner.Worker/Handlers/ScriptHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public async Task RunAsync(ActionRunStage stage)
153153
{
154154
// TODO: figure out how defaults interact with template later
155155
// for now, we won't check job.defaults if we are inside a template.
156-
if (!ExecutionContext.IsComposite && string.IsNullOrEmpty(ExecutionContext.ScopeName) && ExecutionContext.Global.JobDefaults.TryGetValue("run", out var runDefaults))
156+
if (string.IsNullOrEmpty(ExecutionContext.ScopeName) && ExecutionContext.Global.JobDefaults.TryGetValue("run", out var runDefaults))
157157
{
158158
if (runDefaults.TryGetValue("working-directory", out workingDirectory))
159159
{
@@ -169,7 +169,7 @@ public async Task RunAsync(ActionRunStage stage)
169169
{
170170
// TODO: figure out how defaults interact with template later
171171
// for now, we won't check job.defaults if we are inside a template.
172-
if (!ExecutionContext.IsComposite && string.IsNullOrEmpty(ExecutionContext.ScopeName) && ExecutionContext.Global.JobDefaults.TryGetValue("run", out var runDefaults))
172+
if (string.IsNullOrEmpty(ExecutionContext.ScopeName) && ExecutionContext.Global.JobDefaults.TryGetValue("run", out var runDefaults))
173173
{
174174
if (runDefaults.TryGetValue("shell", out shell))
175175
{

0 commit comments

Comments
 (0)