GitLab adapter: pipelines, jobs, job logs and labels #139
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
A GitLab session has no
[3]box data, no job logs, and no label editing until the adapter implements the optional capabilities. Parent: #137. Depends on #138 (theinternal/forge/gitlabpackage); pick this up after #138 merges.Acceptance criteria
forge.RunLister,forge.LogReaderandforge.Labeler, so[3]lists pipelines, a pipeline shows its jobs with their stage,Ropens a pipeline's page, and labels can be edited, as on Forgejo (design.md → Boxes[3]; KeymapR; ADR 0006 capabilities; architecture.md: "GitLab uses pipelines → stages → jobs, which maps toJob.Stage").CIStatevalues as #138's pipeline fold.Plan
In
internal/forge/gitlab, using #138's client:ListRuns:GET /projects/:id/pipelines?per_page=100&order_by=id&sort=descplusref(bare branch) andshafromRunFilter. One page only, newest first, as ADR 0017's runs exception (record it in ADR 0018's consequences or a short addendum). Mapping:ID←id,Number←iid,Workflow←name(falls back tosource),Branch←ref,Commit←sha,Event←source,StartedAt←started_atelsecreated_at,Duration←durationwhen present (the list gains it in GitLab 19.4; older servers leave it zero, no per-pipeline GET),WebURL←web_url. Status: #138's fold.ListJobs:GET …/pipelines/:id/jobs?per_page=100(paginated; retried jobs excluded, GitLab's default).Stage←stage,Name,Statusfolded the same way,Attempt= 1. Trigger (bridge) jobs aren't in this list; leave them out.JobLog:GET /projects/:id/jobs/:job_id/trace, streamed, outside any cache. DropPRIVATE-TOKENon any redirect hop off the API origin (as the github adapter'sJobLog); test it. The log carries ANSI andsection_start/section_endmarkers; pass the bytes through untouched (the Logs view owns rendering).Labeler:ListLabels←GET /projects/:id/labels(group labels included by default; paginated).ItemLabelsreads the item'slabelsnames and maps them toListLabelsIDs (an item label missing from the list keeps ID 0).SetLabelsmaps IDs → names viaListLabels(an unknown ID is an error, so GitLab never auto-creates a label), thenPUTthe issue or MR withlabels=<comma list>(empty clears). Colours: GitLab returns#RRGGBBor a CSS colour name; pass hex through in the format the gitea adapter uses and map a CSS name to "" (the UI's default).docs/architecture.md.Context
internal/forge/github/actions.go,labels.go. Capabilities:internal/forge/forge.go.id, iid, sha, ref, status, source, created_at, updated_at, web_url, name;started_at/durationonly on the single GET before 19.4. Jobs list excludes retried jobs unlessinclude_retried=true; trigger jobs live under…/trigger_jobs. Label colours may be CSS names;PUT … labels=with an unknown name creates a project label.Out of scope
Re-run (
Rerunnerstays undefined, ADR 0006). The[3]box title on GitLab (asked on #141). Trigger/downstream pipelines.🤖 Picked up through composer-lite on branch
feature/139-gitlab-runs; the plan is this ticket body.🤖 MR open (see the linked PR for #139).
🤖 merged: #148