Monorepo for Tangled tangled.org

appview/pulls: fix stacked resubmits using the wrong source-sha #664

merged opened by oppi.li targeting master from push-yzlvxoyxmuyp

the SHA stored on the sh.tangled.repo.pull record was incorrect, causing spindles to report the wrong SHA in pipeline statuses.

Signed-off-by: oppiliappan me@oppi.li

Labels
bugfix
assignee

None yet.

Participants 1
AT URI
at://did:plc:qfpnj4og54vl56wngdriaxug/sh.tangled.repo.pull/3m33jnaki4e22
+13 -12
Interdiff #0 โ†’ #1
+2 -5
appview/db/pulls.go
··· 590 590 return err 591 591 } 592 592 593 - func ResubmitPull(e Execer, pull *models.Pull) error { 594 - newPatch := pull.LatestPatch() 595 - newSourceRev := pull.LatestSha() 596 - newRoundNumber := len(pull.Submissions) 593 + func ResubmitPull(e Execer, pullAt syntax.ATURI, newRoundNumber int, newPatch string, newSourceRev string) error { 597 594 _, err := e.Exec(` 598 595 insert into pull_submissions (pull_at, round_number, patch, source_rev) 599 596 values (?, ?, ?, ?) 600 - `, pull.PullAt(), newRoundNumber, newPatch, newSourceRev) 597 + `, pullAt, newRoundNumber, newPatch, newSourceRev) 601 598 602 599 return err 603 600 }
appview/models/pull.go

This file has not been changed.

+11 -7
appview/pulls/pulls.go
··· 1825 1825 } 1826 1826 defer tx.Rollback() 1827 1827 1828 - pull.Submissions = append(pull.Submissions, &models.PullSubmission{ 1829 - Patch: patch, 1830 - SourceRev: sourceRev, 1831 - }) 1832 - err = db.ResubmitPull(tx, pull) 1828 + pullAt := pull.PullAt() 1829 + newRoundNumber := len(pull.Submissions) 1830 + newPatch := patch 1831 + newSourceRev := sourceRev 1832 + err = db.ResubmitPull(tx, pullAt, newRoundNumber, newPatch, newSourceRev) 1833 1833 if err != nil { 1834 1834 log.Println("failed to create pull request", err) 1835 1835 s.pages.Notice(w, "resubmit-error", "Failed to create pull request. Try again later.") ··· 2020 2020 continue 2021 2021 } 2022 2022 2023 - // resubmit the old pull 2024 - err := db.ResubmitPull(tx, np) 2023 + // resubmit the new pull 2024 + pullAt := op.PullAt() 2025 + newRoundNumber := len(op.Submissions) 2026 + newPatch := np.LatestPatch() 2027 + newSourceRev := np.LatestSha() 2028 + err := db.ResubmitPull(tx, pullAt, newRoundNumber, newPatch, newSourceRev) 2025 2029 2026 2030 if err != nil { 2027 2031 log.Println("failed to update pull", err, op.PullId)

History

2 rounds 0 comments
sign up or login to add to the discussion
oppi.li submitted #1
1 commit
expand
appview/pulls: fix stacked resubmits using the wrong source-sha
expand 0 comments
pull request successfully merged
oppi.li submitted #0
1 commit
expand
appview/pulls: fix stacked resubmits using the wrong source-sha
3/3 success
expand
expand 0 comments