Skip to content

Generate woodpecker-go lib types - #7588

Draft
6543 wants to merge 4 commits into
woodpecker-ci:mainfrom
6543-forks:gen-lib-types
Draft

6543 wants to merge 4 commits into
woodpecker-ci:mainfrom
6543-forks:gen-lib-types

Conversation

@6543

@6543 6543 commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

depends on #7587

the types where out of sync fast ... and with this we just generate them ...

Overview

  • Added types: CancelInfo, QueueTask
  • Changed types: 14
  • Renamed types: Info -> QueueInfo
  • Unchanged types: LogEntry, LogLevel, OrgPatch, PipelineError, Release, Secret, TrustedConfiguration, TrustedConfigurationPatch, Version

Breaking changes (Go API)

Type Change
Info Now QueueInfo
QueueStats Workers, Pending, WaitingOnDeps, Running become WorkerCount, PendingCount, WaitingOnDepsCount, RunningCount. Complete is dropped.
Pipeline Deploy becomes DeployTo
Step, Workflow Stopped becomes Finished
Repo SCMKind removed
Feed Remote removed
User Active removed
RepoPatch IsTrusted and PipelineCounter removed. RequireApproval goes from *ApprovalMode to *string.

Per type

Added

  • QueueInfo: Pending, WaitingOnDeps and Running (all []QueueTask), Stats, Paused.
  • QueueTask: the task shape the queue endpoints return (15 fields).
  • CancelInfo: 3 fields, used by Pipeline.CancelInfo.

Changed

  • Agent: new Filters.
  • Cron: new Timezone and Variables.
  • Feed: Remote removed. New Release and TagTitle.
  • Org: new ForgeID. The id tag gains omitempty.
  • Pipeline:
    • Deploy becomes DeployTo.
    • 13 new fields: DeployTask, Version, RerunCount, Cron, ChangedFiles, AdditionalVariables (variables), CancelInfo, FromFork, IsPrerelease, TagTitle, and the PR fields PullRequestDraft, PullRequestLabels and PullRequestMilestone.
  • PipelineOptions: new Message.
  • Registry: new ReadOnly. The password tag loses omitempty.
  • Repo:
    • SCMKind removed.
    • 15 new fields in these groups:
      • Extensions: config, secret and registry endpoint plus netrc flags, and ConfigExtensionExclusive.
      • Approval and deploy: ApprovalAllowedUsers, AllowDeploy.
      • Forge: ForgeID, HasForgeNameConflict, HasNoForgeRepo.
      • Other: OrgID, CloneSSH, PREnabled.
  • RepoPatch:
    • IsTrusted and PipelineCounter removed.
    • RequireApproval is now *string.
    • Tag changes: Trusted loses omitempty, Visibility gains it.
    • 11 new fields: AllowDeploy, ApprovalAllowedUsers, CancelPreviousPipelineEvents, NetrcTrusted, and the config, secret and registry extension endpoint, netrc and exclusive fields.
  • Step: Stopped becomes Finished. New UUID, PipelineID and DependsOn.
  • Workflow: Stopped becomes Finished. New PipelineID and DependsOn.
  • Task: now the full server model. It gains PID, Name, PipelineID, RepoID, Created, ConcurrencyLimit and ConcurrencyGroup.
  • User:
    • Active removed.
    • New AdminEnv, AdminRevoked and OrgID.
    • Tag changes: admin and forge_id gain omitempty.

The stats of the queue info were an anonymous struct that had to be
written out a second time to fill it. Name it QueueStats so it can be
referenced, also by the types of the go client.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BXsZqxJcVXs3vETtUHiG5r
The types of woodpecker-go are copies of the server models written by
hand, and they have fallen behind: fields are missing, some are named
differently and some no longer exist.

typegen writes them from the source of the server models instead. It
keeps the json tags only, names a model like its swag '@name' and adds
the fields of embedded structs to the struct itself. A type the client
declares by hand is used as is, so enums can stay typed where the
client wants that.

It only reads the source files, so the client still does not import
the server.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BXsZqxJcVXs3vETtUHiG5r
@6543 6543 added this to the 4.0.0 milestone Nov 16, 2026
@6543 6543 added the breaking will break existing installations if no manual action happens label Nov 16, 2026
claude and others added 2 commits November 16, 2026 23:53
The types the API uses are now written by typegen from server/model.
The client gets every field the API has, among them the changed files,
labels and cron of a pipeline and the extension settings of a repo.

Names follow the server now, which renames some types and fields and
drops fields the server never knew. They are listed in the migration
notes. Types that only the client has stay in types.go.

A CI step fails if the generated types are not up to date.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BXsZqxJcVXs3vETtUHiG5r
@6543

6543 commented Nov 16, 2026

Copy link
Copy Markdown
Member Author

if #7586 landed .. last patch is not needed anymore ;)

@woodpecker-bot

Copy link
Copy Markdown
Contributor

Surge PR preview deployment succeeded. View it at https://woodpecker-ci-woodpecker-pr-7588.surge.sh

@6543

6543 commented Nov 16, 2026

Copy link
Copy Markdown
Member Author

PS: we also might generate server/services/config/http.go extension types ... so it is easyer to maintain extensions via our lib ...

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

Labels

breaking will break existing installations if no manual action happens

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants