@@ -25,17 +25,18 @@ type DotnetRsaParameters struct {
2525}
2626
2727type DotnetAgent struct {
28- AgentID string `json:"AgentId"`
29- AgentName string `json:"AgentName"`
30- DisableUpdate string `json:"DisableUpdate"`
31- Ephemeral string `json:"Ephemeral"`
32- PoolID string `json:"PoolId"`
33- PoolName string `json:"PoolName,omitempty"`
34- ServerURL string `json:"ServerUrl"`
35- WorkFolder string `json:"WorkFolder"`
36- GitHubURL string `json:"GitHubUrl"`
37- UseV2Flow bool `json:"UseV2Flow"`
38- ServerURLV2 string `json:"ServerUrlV2"`
28+ AgentID string `json:"AgentId"`
29+ AgentName string `json:"AgentName"`
30+ DisableUpdate string `json:"DisableUpdate"`
31+ Ephemeral string `json:"Ephemeral"`
32+ PoolID string `json:"PoolId"`
33+ PoolName string `json:"PoolName,omitempty"`
34+ ServerURL string `json:"ServerUrl"`
35+ WorkFolder string `json:"WorkFolder"`
36+ GitHubURL string `json:"GitHubUrl"`
37+ UseV2Flow bool `json:"UseV2Flow"`
38+ ServerURLV2 string `json:"ServerUrlV2"`
39+ UseRunnerAdminFlow bool `json:"UseRunnerAdminFlow,omitempty"`
3940}
4041
4142type DotnetCredentials struct {
@@ -138,10 +139,32 @@ func ToRunnerInstance(fileAccess ConfigFileAccess) (*runnerconfiguration.RunnerI
138139 }
139140 ephemeral , _ := strconv .ParseBool (agent .Ephemeral )
140141 disableUpdate , _ := strconv .ParseBool (agent .DisableUpdate )
142+
143+ props := protocol.PropertiesCollection {}
144+ if agent .ServerURL != "" {
145+ props ["ServerUrl" ] = protocol.PropertyValue {
146+ Type : "System.String" ,
147+ Value : agent .ServerURL ,
148+ }
149+ }
150+ if agent .ServerURLV2 != "" {
151+ props ["ServerUrlV2" ] = protocol.PropertyValue {
152+ Type : "System.String" ,
153+ Value : agent .ServerURLV2 ,
154+ }
155+ }
156+ if agent .UseV2Flow {
157+ props ["UseV2Flow" ] = protocol.PropertyValue {
158+ Type : "System.Boolean" ,
159+ Value : agent .UseV2Flow ,
160+ }
161+ }
162+
141163 return & runnerconfiguration.RunnerInstance {
142164 PoolID : poolID ,
143165 Auth : & protocol.GitHubAuthResult {
144166 TenantURL : agent .ServerURL ,
167+ UseV2FLow : agent .UseRunnerAdminFlow ,
145168 },
146169 PKey : FromRsaParameters (rsaParameters ),
147170 Agent : & protocol.TaskAgent {
@@ -155,25 +178,32 @@ func ToRunnerInstance(fileAccess ConfigFileAccess) (*runnerconfiguration.RunnerI
155178 },
156179 DisableUpdate : disableUpdate ,
157180 Version : "3.0.0" ,
158- ServerV2URL : agent . ServerURLV2 ,
181+ Properties : props ,
159182 },
160183 WorkFolder : agent .WorkFolder ,
161184 RegistrationURL : agent .GitHubURL ,
162185 }, nil
163186}
164187
165188func FromRunnerInstance (instance * runnerconfiguration.RunnerInstance , fileAccess ConfigFileAccess ) error {
189+ useV2Flow , _ := instance .Agent .Properties .LookupBool ("UseV2Flow" )
190+ serverURL , ok := instance .Agent .Properties .LookupString ("ServerUrl" )
191+ if serverURL == "" || ! ok {
192+ serverURL = instance .Auth .TenantURL
193+ }
194+ serverV2URL , _ := instance .Agent .Properties .LookupString ("ServerUrlV2" )
166195 agent := & DotnetAgent {
167- AgentID : fmt .Sprint (instance .Agent .ID ),
168- AgentName : instance .Agent .Name ,
169- Ephemeral : fmt .Sprint (instance .Agent .Ephemeral ),
170- DisableUpdate : fmt .Sprint (instance .Agent .DisableUpdate ),
171- PoolID : fmt .Sprint (instance .PoolID ),
172- ServerURL : instance .Auth .TenantURL ,
173- WorkFolder : instance .WorkFolder ,
174- GitHubURL : instance .RegistrationURL ,
175- UseV2Flow : instance .Auth .UseV2FLow ,
176- ServerURLV2 : instance .Agent .ServerV2URL ,
196+ AgentID : fmt .Sprint (instance .Agent .ID ),
197+ AgentName : instance .Agent .Name ,
198+ Ephemeral : fmt .Sprint (instance .Agent .Ephemeral ),
199+ DisableUpdate : fmt .Sprint (instance .Agent .DisableUpdate ),
200+ PoolID : fmt .Sprint (instance .PoolID ),
201+ ServerURL : serverURL ,
202+ WorkFolder : instance .WorkFolder ,
203+ GitHubURL : instance .RegistrationURL ,
204+ UseV2Flow : useV2Flow ,
205+ ServerURLV2 : serverV2URL ,
206+ UseRunnerAdminFlow : instance .Auth .UseV2FLow ,
177207 }
178208 if agent .WorkFolder == "" {
179209 agent .WorkFolder = "_work"
0 commit comments