Null out refName

This commit is contained in:
Chris Sidi
2020-05-20 21:26:37 -04:00
parent fbd859454b
commit 558f6d1a29
2 changed files with 24 additions and 7 deletions

View File

@@ -270,6 +270,12 @@ namespace GitHub.Runner.Worker
{ {
Trace.Entering(); Trace.Entering();
// TODO: Null out old, non-json refNames only if a FF is set.
if (refName != null && !refName.StartsWith("{"))
{
refName = null;
}
var child = new ExecutionContext(); var child = new ExecutionContext();
child.Initialize(HostContext); child.Initialize(HostContext);
child.ScopeName = scopeName; child.ScopeName = scopeName;
@@ -873,7 +879,9 @@ namespace GitHub.Runner.Worker
} }
var newGuid = Guid.NewGuid(); var newGuid = Guid.NewGuid();
return CreateChild(newGuid, displayName, refName ?? newGuid.ToString("N"), null, null, intraActionState, _childTimelineRecordOrder - Root.PostJobSteps.Count);
// TODO: Check feature flag here, conditionally set refName to newGuid.ToString("N").
return CreateChild(newGuid, displayName, refName, null, null, intraActionState, _childTimelineRecordOrder - Root.PostJobSteps.Count);
} }
} }

View File

@@ -5,6 +5,9 @@ namespace GitHub.Runner.Worker
public static class IStepExtensions public static class IStepExtensions
{ {
public static string GetRefName(this IStep step, string defaultRefName = null) public static string GetRefName(this IStep step, string defaultRefName = null)
{
// TODO: Really check a feature flag.
if (s_featureFlagEnabled)
{ {
if (step is JobExtensionRunner extensionRunner && extensionRunner.RepositoryRef != null) if (step is JobExtensionRunner extensionRunner && extensionRunner.RepositoryRef != null)
{ {
@@ -16,7 +19,13 @@ namespace GitHub.Runner.Worker
return JsonConvert.SerializeObject(actionRunner.Action.Reference); return JsonConvert.SerializeObject(actionRunner.Action.Reference);
} }
// RefName should always be valid json or null.
return null;
}
return defaultRefName; return defaultRefName;
} }
private static bool s_featureFlagEnabled = true;
} }
} }