Enable auth migration based on config refresh. (#3786)

This commit is contained in:
Tingluo Huang
2025-04-02 23:24:57 -04:00
committed by GitHub
parent a0a0a76378
commit c1095ae2d1
9 changed files with 94 additions and 32 deletions

View File

@@ -211,7 +211,17 @@ namespace GitHub.Runner.Listener
// save the refreshed runner credentials as a separate file
_store.SaveMigratedCredential(refreshedCredConfig);
await ReportTelemetryAsync("Runner credentials updated successfully.");
if (refreshedCredConfig.Data.ContainsKey("authorizationUrlV2"))
{
HostContext.EnableAuthMigration("Credential file updated");
await ReportTelemetryAsync("Runner credentials updated successfully. Auth migration is enabled.");
}
else
{
HostContext.DeferAuthMigration(TimeSpan.FromDays(365), "Credential file does not contain authorizationUrlV2");
await ReportTelemetryAsync("Runner credentials updated successfully. Auth migration is disabled.");
}
}
private async Task<bool> VerifyRunnerQualifiedId(string runnerQualifiedId)