Rework pipeline data structure: Commit#6779
Draft
6543 wants to merge 3 commits into
Draft
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Member
Author
|
well the
could be a problem ... it should not be, but it wont hurt to be explizite ... -> added it to #6796 @AhmadNajiKam keep in mind this pull here is a draft because i used claude to port over just the commit changes ... but we should not trust claude to do it's job correctly! ... so before this is not marked ready i did not have looked into it, so expect bad things to be in this (so not sure if it is worth you effort to review 😅 ) |
The pipeline model carried the commit identity as four flat columns
(commit, message, timestamp, email). Group them into a reusable Commit
substruct (sha, message, forge_url, author{name,email}, timestamp),
reusing the existing model.Commit type already returned by BranchHead.
All forge producers (gitea, forgejo, github, gitlab, bitbucket,
bitbucket datacenter), the cron and manual pipeline builders, and every
consumer (file/dir fetch, commit-status, skip-ci, metadata, feed) are
updated to read and write the nested struct. Commit reads are nil-safe.
The HTTP API stays backward compatible: APIPipeline and APIFeed still
emit the deprecated commit, message, timestamp and author_email fields,
populated from the substruct in ToAPIModel, so existing clients and the
web UI keep working. The woodpecker-go client additionally exposes the
new nested commit via commit_pipeline.
The flat message, timestamp and email columns are dropped and the commit
column is converted to JSON by migration 029, which folds the old values
into the substruct with a single bulk UPDATE per page (Postgres json
casts handled explicitly). It runs after the tag/release migration (028),
which still reads the message column.
This is a self-contained slice carved out of the larger pipeline
restructure (woodpecker-ci#4626), following the tag/release extraction (woodpecker-ci#6774).
c494630 to
e335653
Compare
Contributor
|
Surge PR preview deployment succeeded. View it at https://woodpecker-ci-woodpecker-pr-6779.surge.sh |
updatePipelineFromCommits read p.Commit.SHA in the GetCommit call before the nil check that follows it, so a pipeline reaching this path without a populated Commit would panic on the first line rather than be defended by the guard three lines later. Current Bitbucket Data Center constructors always populate Commit before this runs, but that is incidental, not enforced. Move the guard above the first dereference, matching the nil-safe pattern already used in gitlab.go's File, Dir and loadCommitFromSHA.
6543
commented
Jul 7, 2026
| Name: user.Login, | ||
| Email: user.Email, | ||
| }, | ||
| Timestamp: time.Now().UTC().Unix(), |
Member
Author
There was a problem hiding this comment.
we must use commit timestamp
6543
commented
Jul 7, 2026
| Commit: &model.Commit{ | ||
| SHA: commit.SHA, | ||
| ForgeURL: commit.ForgeURL, | ||
| Timestamp: cron.NextExec, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
-> start split out from #4626
split out with claude, so rougth review needed ... will only make it ready once i did so myselfe
The pipeline model carried the commit identity as four flat columns (commit, message, timestamp, email). Group them into a reusable Commit substruct (sha, message, forge_url, author{name,email}, timestamp), reusing the existing model.Commit type already returned by BranchHead.
All forge producers (gitea, forgejo, github, gitlab, bitbucket, bitbucket datacenter), the cron and manual pipeline builders, and every consumer (file/dir fetch, commit-status, skip-ci, metadata, feed) are updated to read and write the nested struct. Commit reads are nil-safe.
The HTTP API stays backward compatible: APIPipeline and APIFeed still emit the deprecated commit, message, timestamp and author_email fields, populated from the substruct in ToAPIModel, so existing clients and the web UI keep working. The flat message, timestamp and email columns are dropped and the commit column is converted to JSON by migration 028.
This is a self-contained slice carved out of the larger pipeline restructure (#4626) to ease review and upstreaming.