Skip to content

Commit

Permalink
Load '_runnerSettings' in the early point of JobRunner.cs (#3218)
Browse files Browse the repository at this point in the history
  • Loading branch information
TingluoHuang authored Mar 24, 2024
1 parent a52c539 commit 77e0bfb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Runner.Worker/JobRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public async Task<TaskResult> RunAsync(AgentJobRequestMessage message, Cancellat
Trace.Info("Job ID {0}", message.JobId);

DateTime jobStartTimeUtc = DateTime.UtcNow;
_runnerSettings = HostContext.GetService<IConfigurationStore>().GetSettings();
IRunnerService server = null;

// add orchestration id to useragent for better correlation.
Expand Down Expand Up @@ -164,8 +165,6 @@ public async Task<TaskResult> RunAsync(AgentJobRequestMessage message, Cancellat

jobContext.SetRunnerContext("os", VarUtil.OS);
jobContext.SetRunnerContext("arch", VarUtil.OSArchitecture);

_runnerSettings = HostContext.GetService<IConfigurationStore>().GetSettings();
jobContext.SetRunnerContext("name", _runnerSettings.AgentName);

if (jobContext.Global.Variables.TryGetValue(WellKnownDistributedTaskVariables.RunnerEnvironment, out var runnerEnvironment))
Expand Down

0 comments on commit 77e0bfb

Please sign in to comment.