Skip to content

Commit

Permalink
chore(tibuild): add debug log (#224)
Browse files Browse the repository at this point in the history
Signed-off-by: wuhuizuo <[email protected]>
  • Loading branch information
wuhuizuo authored Jan 29, 2025
1 parent 8a17a7b commit acdc94d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tibuild/pkg/rest/service/cloud_event_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package service

import (
"context"
"encoding/json"
"fmt"
"log/slog"
"strings"
Expand Down Expand Up @@ -38,10 +39,14 @@ type CloudEventClient struct {
}

func (s CloudEventClient) TriggerDevBuild(ctx context.Context, dev DevBuild) error {
bs, _ := json.Marshal(dev)
slog.InfoContext(ctx, "trigger dev build", "dev", string(bs))
event, err := newDevBuildCloudEvent(dev)
if err != nil {
return err
}
eventBytes, _ := event.MarshalJSON()
slog.InfoContext(ctx, "trigger dev build event", "event", string(eventBytes))
c := cloudevents.ContextWithTarget(ctx, s.endpoint)
if result := s.client.Send(c, *event); !protocol.IsACK(result) {
slog.ErrorContext(ctx, "failed to send", "reason", result)
Expand Down

0 comments on commit acdc94d

Please sign in to comment.