Skip to content

feat(actions): add build queue view - #38585

Open
bircni wants to merge 3 commits into
go-gitea:mainfrom
bircni:feat/actions-build-queue
Open

feat(actions): add build queue view#38585
bircni wants to merge 3 commits into
go-gitea:mainfrom
bircni:feat/actions-build-queue

Conversation

@bircni

@bircni bircni commented Jul 22, 2026

Copy link
Copy Markdown
Member

Adds a build queue view for Actions that answers "what runs next, and why is my
build waiting?" — and lets admins reorder the queue.

Two places surface it:

  • Instance queue (site admins), under the admin Actions section — every waiting
    and running job across the whole instance.
  • Repository queue, in the repo Actions tab next to Runs (Runs | Queue).

Each view shows:

  • Running jobs currently executing (on top).
  • Queued jobs in the exact order a runner will pick them up (below).

The list auto-refreshes in place.

Why

Until now there was no way to see the pending Actions queue. Runs are only visible
per-repository (newest-first), and nothing showed the order jobs get picked up or
what is currently running — nor any way to intervene when an important build is
stuck behind others.

What's new

  • Queue views at instance (admin) and repository scope.
  • Drag-and-drop reordering (admins only — repo admins on the repo queue, site
    admins on the instance queue). Reordering changes the real runner pickup order,
    not just the display. It promotes a job in the queue; the job still only runs
    once a runner with matching labels is free.

Scope / limitation

Ordering is globally exact only at the instance (admin) scope. The repository
queue is a filtered slice of the instance-wide queue, so it shows the correct
relative order of that repo's jobs but not their absolute position (org/user
runners pull across repositories).

Screenshots

image

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 22, 2026
@bircni
bircni force-pushed the feat/actions-build-queue branch from 2aa2ddf to f8da20b Compare July 22, 2026 19:48
@bircni
bircni requested a review from Zettat123 July 22, 2026 19:48
@bircni bircni added the release/highlight Marks a PR as a highlight-worthy change for the release notes. label Jul 22, 2026
@bircni bircni added this to the 28.0.0 milestone Jul 22, 2026
@github-actions github-actions Bot added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Jul 22, 2026
@lunny

lunny commented Jul 23, 2026

Copy link
Copy Markdown
Member

I don’t understand why this needs to be a separate jobs list.

@github-actions github-actions Bot added the topic/gitea-actions related to the actions of Gitea label Jul 24, 2026
@lunny

lunny commented Jul 24, 2026

Copy link
Copy Markdown
Member

I think we should have a global Jobs page under Actions, as well as an organization-level Jobs page. A repository-level Jobs page does not seem particularly useful.

@bircni

bircni commented Jul 24, 2026

Copy link
Copy Markdown
Member Author

Currently completely redesigning it

@bircni
bircni marked this pull request as draft July 24, 2026 16:14
@bircni
bircni force-pushed the feat/actions-build-queue branch from 27b73ec to 42c0e0e Compare July 24, 2026 16:38
Add a build queue view that lists running and waiting Actions jobs in
real runner-pickup order, with auto-refresh in place:

- Instance-wide queue for site admins under the admin Actions section.
- Per-repository queue in the repo Actions tab (Runs | Queue sub-nav).

Admins can reorder waiting jobs by drag-and-drop, which changes the
actual runner pickup order rather than just the view. Reordering is
backed by an internal queue_rank column on ActionRunJob (0 = natural
FIFO by updated,id; manually placed jobs get spaced ranks) applied
consistently in the queued-jobs listing and in the CreateTaskForRunner
keyset cursor. New jobs join the back of a curated queue and the order
self-heals as jobs are claimed.

Add migration v343 for the queue_rank column and a devtest page to
exercise the queue list and reordering UI.
@bircni
bircni force-pushed the feat/actions-build-queue branch from 42c0e0e to c43ea88 Compare July 24, 2026 16:38
@bircni
bircni marked this pull request as ready for review July 24, 2026 16:38
@bircni
bircni requested a review from silverwind July 24, 2026 16:38
@silverwind
silverwind requested a review from Copilot July 27, 2026 08:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds an Actions build queue UI at both instance-admin and repository scope, backed by a persistent queue ordering mechanism so admins can reorder jobs in the actual runner pickup order.

Changes:

  • Introduces queue views (admin and repo) with auto-refreshing “Running” and “Queued” job lists.
  • Adds drag-and-drop reordering for admins, persisting order via a new queue_rank on ActionRunJob.
  • Updates runner task pickup to respect the new queue ordering; adds unit/integration coverage and DB migration.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
web_src/js/features/repo-actions.ts Registers/init queue list auto-refresh and drag-reorder POST for the UI fragment.
tests/integration/actions_queue_test.go Integration coverage for viewing queue + permission-gated reordering.
templates/shared/actions/queue_list.tmpl Shared queue list fragment (running + queued tables, reorder handle, pagination).
templates/repo/actions/queue.tmpl New repo Actions “Queue” page wrapper.
templates/repo/actions/list.tmpl Adds `Runs
templates/devtest/actions-queue.tmpl Devtest page to exercise queue reorder UI without DB/runners.
templates/admin/navbar.tmpl Adds admin nav entry for Actions Queue.
templates/admin/actions.tmpl Renders the shared queue list for admin actions “queue” page type.
routers/web/web.go Wires new admin and repo queue routes (+ devtest endpoints).
routers/web/shared/actions/runners.go Implements queue query/rendering + reorder POST handler for admin/shared scopes.
routers/web/repo/actions/queue.go Repo-scoped queue render + reorder handler (repo-admin gated).
routers/web/devtest/mock_actions.go Provides mock queue data + logs reorder payload in devtest.
options/locale/locale_en-US.json Adds new locale keys for “Queue” UI and related labels.
models/actions/task.go Updates runner pickup scan to order by (queue_rank, updated, id) with keyset cursor.
models/actions/run_job.go Adds QueueRank field to ActionRunJob.
models/actions/run_job_queue.go Implements MoveQueuedJob and queue-rank assignment strategy.
models/actions/run_job_queue_test.go Unit tests for MoveQueuedJob behavior and ordering invariants.
models/actions/run_job_list.go Defines QueuedJobsOrderBy and adds queue-related filter options to queries.
models/actions/run_job_list_test.go Tests queued-job filtering and ordering behavior.
modelmigration/v1_27/v343.go DB migration adding queue_rank column/index.
modelmigration/migrations.go Registers migration 343.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread routers/web/shared/actions/runners.go Outdated
@bircni

bircni commented Jul 27, 2026

Copy link
Copy Markdown
Member Author

@silverwind fixed

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

Labels

lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. release/highlight Marks a PR as a highlight-worthy change for the release notes. topic/gitea-actions related to the actions of Gitea type/feature Completely new functionality. Can only be merged if feature freeze is not active.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants