Skip to content

Commit c8794ed

Browse files
committed
pass billing owner id between run service calls
1 parent 3a99070 commit c8794ed

4 files changed

Lines changed: 20 additions & 14 deletions

File tree

actionsrunner/runner.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ type RunnerJobRequestRef struct {
401401
Id string `json:"id"`
402402
RunnerRequestId string `json:"runner_request_id"`
403403
RunServiceUrl string `json:"run_service_url"`
404+
BillingOwnerId string `json:"billing_owner_id,omitempty"`
404405
}
405406

406407
type plainTextFormatter struct {
@@ -454,8 +455,9 @@ func runJob(runnerenv RunnerEnvironment, joblock *sync.Mutex, vssConnection *pro
454455
acquirejobUrl.Path = path.Join(acquirejobUrl.Path, "acquirejob")
455456
vssConnection.TenantURL = runServiceUrl
456457
payload := &runservice.AcquireJobRequest{
457-
StreamID: rjrr.RunnerRequestId,
458-
JobMessageID: rjrr.RunnerRequestId,
458+
StreamID: rjrr.RunnerRequestId,
459+
JobMessageID: rjrr.RunnerRequestId,
460+
BillingOwnerId: rjrr.BillingOwnerId,
459461
}
460462
err = vssConnection.RequestWithContext2(jobctx, "POST", acquirejobUrl.String(), "", payload, &src)
461463
}

actionsrunner/worker_context.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ type DefaultWorkerContext struct {
3131
func (wc *DefaultWorkerContext) FinishJob(result string, outputs *map[string]protocol.VariableValue) {
3232
if strings.EqualFold(wc.Message().MessageType, "RunnerJobRequest") {
3333
payload := &run.CompleteJobRequest{
34-
PlanID: wc.Message().Plan.PlanID,
35-
JobID: wc.Message().JobID,
36-
Conclusion: strings.ToLower(result),
37-
Outputs: nil,
34+
PlanID: wc.Message().Plan.PlanID,
35+
JobID: wc.Message().JobID,
36+
Conclusion: strings.ToLower(result),
37+
Outputs: nil,
38+
BillingOwnerId: wc.Message().BillingOwnerId,
3839
}
3940
if outputs != nil {
4041
payload.Outputs = *outputs

protocol/misc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ type AgentJobRequestMessage struct {
104104
Variables map[string]VariableValue
105105
Steps []ActionStep
106106
FileTable []string
107+
BillingOwnerId string `json:"billingOwnerId,omitempty"`
107108
}
108109

109110
func (jobreq *AgentJobRequestMessage) GetConnection(name string) (*VssConnection, map[string]string, error) {

protocol/run/contracts.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@ import (
99
)
1010

1111
type AcquireJobRequest struct {
12-
StreamID string `json:"streamId,omitempty"` // Deprecated: https://github.com/actions/runner/pull/2547
13-
JobMessageID string `json:"jobMessageId"`
12+
StreamID string `json:"streamId,omitempty"` // Deprecated: https://github.com/actions/runner/pull/2547
13+
JobMessageID string `json:"jobMessageId"`
14+
BillingOwnerId string `json:"billingOwnerId,omitempty"`
1415
}
1516

1617
type CompleteJobRequest struct {
17-
PlanID string `json:"planId,omitempty"`
18-
JobID string `json:"jobId,omitempty"`
19-
Conclusion string `json:"conclusion"`
20-
Outputs map[string]protocol.VariableValue `json:"outputs,omitempty"`
21-
StepResults []StepResult `json:"stepResults,omitempty"`
22-
Annotations []Annotation `json:"annotations,omitempty"`
18+
PlanID string `json:"planId,omitempty"`
19+
JobID string `json:"jobId,omitempty"`
20+
Conclusion string `json:"conclusion"`
21+
Outputs map[string]protocol.VariableValue `json:"outputs,omitempty"`
22+
StepResults []StepResult `json:"stepResults,omitempty"`
23+
Annotations []Annotation `json:"annotations,omitempty"`
24+
BillingOwnerId string `json:"billingOwnerId,omitempty"`
2325
}
2426

2527
type RenewJobRequest struct {

0 commit comments

Comments
 (0)