Skip to content

Commit c353760

Browse files
committed
Add mock logging
1 parent df18086 commit c353760

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Runner.Listener/SelfUpdater.cs

+7-2
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,19 @@ private async Task DownloadLatestRunner(CancellationToken token)
182182

183183
try
184184
{
185-
#if DEBUG
186185
// Much of the update process (targetVersion, archive) is server-side, this is a way to control it from here for testing specific update scenarios
187186
// Add files like 'runner_v2.281.2.tar.gz' or 'runner_v2.283.0.zip' depending on your platform in your runner root folder
188187
// Note that runners still need to be behind the server's runner version in order to receive an 'AgentRefreshMessage' and trigger this update
189188
// This should not be in the release build to prevent tampering with updates
190189
var isMockUpdate = StringUtil.ConvertToBoolean(Environment.GetEnvironmentVariable("GITHUB_ACTIONS_RUNNER_IS_MOCK_UPDATE"));
190+
191+
_terminal.WriteLine(isMockUpdate.ToString());
191192
if (isMockUpdate)
192193
{
193194
// the env var should be of format GITHUB_ACTIONS_RUNNER_MOCK_VERSION_LIST='v2.281.2,v2.283.0,v2.283.1,v2.284.0'
194195
var mockVersions = Environment.GetEnvironmentVariable("GITHUB_ACTIONS_RUNNER_MOCK_VERSION_LIST").Split(',');
196+
197+
_terminal.WriteLine(string.Join(",", mockVersions));
195198
if (mockVersions.Any())
196199
{
197200
var targetVersion = mockVersions.First();
@@ -205,12 +208,14 @@ private async Task DownloadLatestRunner(CancellationToken token)
205208
archiveFile = Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Root), $"runner{targetVersion}.tar.gz");
206209
}
207210

211+
_terminal.WriteLine($"Mock target version is: {targetVersion}");
212+
208213
var newMockVersions = string.Join(",", mockVersions.Skip(1));
209214
Environment.SetEnvironmentVariable("GITHUB_ACTIONS_RUNNER_MOCK_VERSION_LIST", newMockVersions);
210215
_updateTrace.Add($"Mocking update with file: {archiveFile}, nothing is downloaded");
216+
_terminal.WriteLine($"Mocking update with file: {archiveFile}, nothing is downloaded");
211217
}
212218
}
213-
#endif
214219
// archiveFile is not null only if we mocked it above
215220
if (archiveFile == null)
216221
{

0 commit comments

Comments
 (0)