Skip to content

Commit 03e9361

Browse files
committed
fix: only send invocationId to Workflows plugin if ASPECT_BEP_WRITE_LAST_VIA_PIPE is set
1 parent 8156741 commit 03e9361

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/plugin/system/bep/bes_pipe.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ func (bb *besPipe) streamBesEvents(ctx context.Context, conn *os.File) error {
228228

229229
seqId++
230230

231-
if err := bb.publishBesEvent(seqId, bb.besInvocationId, &event); err != nil {
231+
if err := bb.publishBesEvent(seqId, &event); err != nil {
232232
return fmt.Errorf("failed to publish BES event: %w", err)
233233
}
234234

@@ -243,13 +243,17 @@ func (bb *besPipe) streamBesEvents(ctx context.Context, conn *os.File) error {
243243
return nil
244244
}
245245

246-
func (bb *besPipe) publishBesEvent(seqId int64, invocationId string, event *buildeventstream.BuildEvent) error {
246+
func (bb *besPipe) publishBesEvent(seqId int64, event *buildeventstream.BuildEvent) error {
247247
eg := errgroup.Group{}
248248

249249
for s := bb.subscribers.head; s != nil; s = s.next {
250250
cb := s.callback
251251
eg.Go(
252252
func() error {
253+
var invocationId string
254+
if os.Getenv("ASPECT_BEP_WRITE_LAST_VIA_PIPE") != "" {
255+
invocationId = bb.besInvocationId
256+
}
253257
return cb(event, seqId, invocationId)
254258
},
255259
)

0 commit comments

Comments
 (0)