Skip to content

Rework pipeline data structure: Commit#6779

Draft
6543 wants to merge 3 commits into
woodpecker-ci:mainfrom
6543-forks:Rework-pipeline-data-structure#4626_Commit-extracted
Draft

Rework pipeline data structure: Commit#6779
6543 wants to merge 3 commits into
woodpecker-ci:mainfrom
6543-forks:Rework-pipeline-data-structure#4626_Commit-extracted

Conversation

@6543

@6543 6543 commented Jun 24, 2026

Copy link
Copy Markdown
Member

-> 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.

@6543 6543 added server refactor delete or replace old code wip labels Jun 24, 2026
@AhmadNajiKam

This comment was marked as off-topic.

@AhmadNajiKam

This comment was marked as off-topic.

@6543

6543 commented Jun 28, 2026

Copy link
Copy Markdown
Member Author

well the

Problem: Offset pagination loop has no stable sort order, so pages can skip or duplicate rows mid-migration

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).
@6543 6543 force-pushed the Rework-pipeline-data-structure#4626_Commit-extracted branch from c494630 to e335653 Compare July 2, 2026 02:42
@woodpecker-bot

woodpecker-bot commented Jul 2, 2026

Copy link
Copy Markdown
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.
Comment thread server/api/pipeline.go
Name: user.Login,
Email: user.Email,
},
Timestamp: time.Now().UTC().Unix(),

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we must use commit timestamp

Comment thread server/cron/cron.go
Commit: &model.Commit{
SHA: commit.SHA,
ForgeURL: commit.ForgeURL,
Timestamp: cron.NextExec,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor delete or replace old code server wip

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants