Skip to content

Commit 3a99070

Browse files
[!IMPORTANT] fix run service compatibility (#202)
* enums must be sent in lowercase * renewjob must be called with SystemVssConnection token of job * add PipelinesServiceUrl as ACTIONS_RUNTIME_URL
1 parent 79cbe02 commit 3a99070

4 files changed

Lines changed: 18 additions & 6 deletions

File tree

actionsdotnetactcompat/act_worker.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,9 @@ func ExecWorker(rqt *protocol.AgentJobRequestMessage, wc actionsrunner.WorkerCon
254254
if resultsServiceUrl, ok := vssConnectionData["ResultsServiceUrl"]; ok && len(resultsServiceUrl) > 0 {
255255
env["ACTIONS_RESULTS_URL"] = resultsServiceUrl
256256
}
257+
if pipelinesServiceUrl, ok := vssConnectionData["PipelinesServiceUrl"]; ok && len(pipelinesServiceUrl) > 0 {
258+
env["ACTIONS_RUNTIME_URL"] = pipelinesServiceUrl
259+
}
257260
if uses_cache_service_v2, ok := rqt.Variables["actions_uses_cache_service_v2"]; ok && strings.EqualFold(uses_cache_service_v2.Value, "True") {
258261
env["ACTIONS_CACHE_SERVICE_V2"] = "True" // bool.TrueString
259262
}

actionsrunner/runner.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,16 +488,17 @@ func runJob(runnerenv RunnerEnvironment, joblock *sync.Mutex, vssConnection *pro
488488
for {
489489
var err error
490490
if runServiceUrl != "" {
491-
vssConnection = &con
491+
jobVssConnection, _, _ := jobreq.GetConnection("SystemVssConnection")
492+
jobVssConnection.Trace = con.Trace
492493
renewjobUrl, _ := url.Parse(runServiceUrl)
493494
renewjobUrl.Path = path.Join(renewjobUrl.Path, "renewjob")
494-
vssConnection.TenantURL = runServiceUrl
495+
jobVssConnection.TenantURL = runServiceUrl
495496
payload := &runservice.RenewJobRequest{
496497
PlanID: jobreq.Plan.PlanID,
497498
JobID: jobreq.JobID,
498499
}
499500
resp := &runservice.RenewJobResponse{}
500-
err = vssConnection.RequestWithContext2(jobctx, "POST", renewjobUrl.String(), "", payload, &resp)
501+
err = jobVssConnection.RequestWithContext2(jobctx, "POST", renewjobUrl.String(), "", payload, &resp)
501502
} else {
502503
err = con.RequestWithContext(jobctx, "fc825784-c92a-4299-9221-998a02d1b54f", "5.1-preview", "PATCH", map[string]string{
503504
"poolId": fmt.Sprint(instance.PoolID),

actionsrunner/worker_context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (wc *DefaultWorkerContext) FinishJob(result string, outputs *map[string]pro
3333
payload := &run.CompleteJobRequest{
3434
PlanID: wc.Message().Plan.PlanID,
3535
JobID: wc.Message().JobID,
36-
Conclusion: result,
36+
Conclusion: strings.ToLower(result),
3737
Outputs: nil,
3838
}
3939
if outputs != nil {

protocol/run/contracts.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ type StepResult struct {
4343
Annotations []Annotation `json:"annotations,omitempty"`
4444
}
4545

46+
func toLowerStringP(p *string) *string {
47+
if p == nil {
48+
return nil
49+
}
50+
ret := strings.ToLower(*p)
51+
return &ret
52+
}
53+
4654
func TimeLineRecordToStepResult(rec protocol.TimelineRecord) StepResult {
4755
annotations := make([]Annotation, len(rec.Issues))
4856
for i, issue := range rec.Issues {
@@ -51,8 +59,8 @@ func TimeLineRecordToStepResult(rec protocol.TimelineRecord) StepResult {
5159

5260
return StepResult{
5361
ExternalID: rec.ID,
54-
Conclusion: rec.Result,
55-
Status: rec.State,
62+
Conclusion: toLowerStringP(rec.Result),
63+
Status: strings.ToLower(rec.State),
5664
Number: int(rec.Order),
5765
Name: rec.Name,
5866
StartedAt: rec.StartTime,

0 commit comments

Comments
 (0)