Skip to content

Commit

Permalink
Merge branch 'enhance/build-sender-id' of github.com:go-vela/server i…
Browse files Browse the repository at this point in the history
…nto feat/oidc-provider
  • Loading branch information
plyr4 committed Jun 4, 2024
2 parents 3d50f56 + 37d5dfc commit 4ad8f5a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion api/build/restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func RestartBuild(c *gin.Context) {
b.SetSender(cl.Subject)

// fetch scm user id
senderID, err := scm.GetUserID(ctx, u.GetName(), u.GetToken())
senderID, err := scm.GetUserID(ctx, u.GetName(), r.GetOwner().GetToken())
if err != nil {
retErr := fmt.Errorf("unable to get SCM user id for %s: %w", u.GetName(), err)

Expand Down
10 changes: 2 additions & 8 deletions cmd/vela-server/schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,10 @@ func processSchedule(ctx context.Context, s *api.Schedule, settings *settings.Pl
b.SetRepo(r)
b.SetSender(s.GetUpdatedBy())

// send API call to capture the user for the schedule trigger
u, err := database.GetUserForName(ctx, s.GetUpdatedBy())
if err != nil {
return fmt.Errorf("unable to get user for name %s: %w", s.GetUpdatedBy(), err)
}

// fetch scm user id
senderID, err := scm.GetUserID(ctx, u.GetName(), u.GetToken())
senderID, err := scm.GetUserID(ctx, s.GetUpdatedBy(), r.GetOwner().GetToken())
if err != nil {
return fmt.Errorf("unable to get SCM user id for %s: %w", u.GetName(), err)
return fmt.Errorf("unable to get SCM user id for %s: %w", s.GetUpdatedBy(), err)
}

b.SetSenderSCMID(senderID)
Expand Down

0 comments on commit 4ad8f5a

Please sign in to comment.