Skip to content

Commit e5d27da

Browse files
pass billing owner id between run service calls (#203)
1 parent 56be12a commit e5d27da

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
@@ -434,6 +434,7 @@ type RunnerJobRequestRef struct {
434434
ID string `json:"id"`
435435
RunnerRequestID string `json:"runner_request_id"`
436436
RunServiceURL string `json:"run_service_url"`
437+
BillingOwnerID string `json:"billing_owner_id,omitempty"`
437438
}
438439

439440
type plainTextFormatter struct{}
@@ -493,8 +494,9 @@ func runJob(runnerenv RunnerEnvironment, joblock *sync.Mutex, vssConnection *pro
493494
acquirejobURL.Path = path.Join(acquirejobURL.Path, "acquirejob")
494495
vssConnection.TenantURL = runServiceURL
495496
payload := &runservice.AcquireJobRequest{
496-
StreamID: rjrr.RunnerRequestID,
497-
JobMessageID: rjrr.RunnerRequestID,
497+
StreamID: rjrr.RunnerRequestID,
498+
JobMessageID: rjrr.RunnerRequestID,
499+
BillingOwnerID: rjrr.BillingOwnerID,
498500
}
499501
requestErr = vssConnection.RequestWithContext2(jobctx, "POST", acquirejobURL.String(), "", payload, &src)
500502
}

actionsrunner/worker_context.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ type DefaultWorkerContext struct {
4040
func (wc *DefaultWorkerContext) FinishJob(result string, outputs *map[string]protocol.VariableValue) {
4141
if strings.EqualFold(wc.Message().MessageType, "RunnerJobRequest") {
4242
payload := &run.CompleteJobRequest{
43-
PlanID: wc.Message().Plan.PlanID,
44-
JobID: wc.Message().JobID,
45-
Conclusion: strings.ToLower(result),
46-
Outputs: nil,
43+
PlanID: wc.Message().Plan.PlanID,
44+
JobID: wc.Message().JobID,
45+
Conclusion: strings.ToLower(result),
46+
Outputs: nil,
47+
BillingOwnerID: wc.Message().BillingOwnerID,
4748
}
4849
if outputs != nil {
4950
payload.Outputs = *outputs

protocol/misc.go

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

110111
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)