From 608a7ffad1fbe0ae356a6afa0e3a8d8ce66d6f9c Mon Sep 17 00:00:00 2001 From: Brandon Duffany Date: Mon, 1 Jul 2024 10:30:04 -0400 Subject: [PATCH] Fix 'bazel' status reported for each workflow (#6965) --- enterprise/server/cmd/ci_runner/main.go | 44 ++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/enterprise/server/cmd/ci_runner/main.go b/enterprise/server/cmd/ci_runner/main.go index ec46e38c4e9..9fad70e76d7 100644 --- a/enterprise/server/cmd/ci_runner/main.go +++ b/enterprise/server/cmd/ci_runner/main.go @@ -860,6 +860,28 @@ func (ar *actionRunner) Run(ctx context.Context, ws *workspace) error { // because that error is instead surfaced in the caller func when calling // `buildEventPublisher.Wait()` + wfc := &bespb.WorkflowConfigured{ + WorkflowId: *workflowID, + ActionName: getActionNameForWorkflowConfiguredEvent(), + ActionTriggerEvent: *triggerEvent, + PushedRepoUrl: *pushedRepoURL, + PushedBranch: *pushedBranch, + CommitSha: *commitSHA, + TargetRepoUrl: *targetRepoURL, + TargetBranch: *targetBranch, + Os: runtime.GOOS, + Arch: runtime.GOARCH, + } + wfcEvent := &bespb.BuildEvent{ + Id: &bespb.BuildEventId{Id: &bespb.BuildEventId_WorkflowConfigured{WorkflowConfigured: &bespb.BuildEventId_WorkflowConfiguredId{}}}, + Payload: &bespb.BuildEvent_WorkflowConfigured{WorkflowConfigured: wfc}, + } + if ar.isWorkflow { + if err := ar.reporter.Publish(wfcEvent); err != nil { + return nil + } + } + buildMetadata := &bespb.BuildMetadata{ Metadata: map[string]string{}, } @@ -903,28 +925,6 @@ func (ar *actionRunner) Run(ctx context.Context, ws *workspace) error { // Only print this to the local logs -- it's mostly useful for development purposes. log.Infof("Invocation URL: %s", invocationURL(ar.reporter.InvocationID())) - wfc := &bespb.WorkflowConfigured{ - WorkflowId: *workflowID, - ActionName: getActionNameForWorkflowConfiguredEvent(), - ActionTriggerEvent: *triggerEvent, - PushedRepoUrl: *pushedRepoURL, - PushedBranch: *pushedBranch, - CommitSha: *commitSHA, - TargetRepoUrl: *targetRepoURL, - TargetBranch: *targetBranch, - Os: runtime.GOOS, - Arch: runtime.GOARCH, - } - wfcEvent := &bespb.BuildEvent{ - Id: &bespb.BuildEventId{Id: &bespb.BuildEventId_WorkflowConfigured{WorkflowConfigured: &bespb.BuildEventId_WorkflowConfiguredId{}}}, - Payload: &bespb.BuildEvent_WorkflowConfigured{WorkflowConfigured: wfc}, - } - if ar.isWorkflow { - if err := ar.reporter.Publish(wfcEvent); err != nil { - return nil - } - } - if err := ws.setup(ctx); err != nil { return status.WrapError(err, "failed to set up git repo") }