fix(bbdc): resolve annotated tag object SHA to commit SHA before posting build status (#6203)

Co-authored-by: Harri <harri.eranen@nordhero.com>
This commit is contained in:
Harri Eränen
2026-03-06 16:43:58 +02:00
committed by GitHub
parent 739114bf3a
commit 1772ba091f

View File

@@ -579,6 +579,14 @@ func (c *client) updatePipelineFromCommits(ctx context.Context, u *model.User, r
if err != nil {
return nil, fmt.Errorf("unable to read commit: %w", err)
}
// In Bitbucket Data Center, when using annotated tags, the webhook's ToHash is the tag object SHA, not the actual commit SHA.
// Update p.Commit so that build statuses are posted to the correct commit SHA.
if p.Event == model.EventTag && commit.ID != "" && commit.ID != p.Commit {
p.Commit = commit.ID
p.ForgeURL = fmt.Sprintf("%s/projects/%s/repos/%s/commits/%s", c.url, r.Owner, r.Name, commit.ID)
}
p.Message = commit.Message
opts := &bb.CompareChangesOptions{}