Every CI action is a CRUD action, and the URLs do not move
`CiController` had three actions named after verbs — `pipelines`, `status`,
`trigger` — and built its JSON by hand in a private `pipeline_json`, in a
codebase where everything else is serialized by Blueprinter. Triggering a
build is the creation of a run, so it is a resource of its own:
GET /api/ci/pipelines -> Api::Ci::PipelinesController#index
GET /api/ci/pipelines/:id/status -> Api::Ci::PipelinesController#show
POST /api/ci/pipelines/:id/trigger -> Api::Ci::PipelineRunsController#create
The addresses are untouched on purpose: they are what the CI and the scripts
already call, and renaming them would be a breaking change for a version that
does not need one. What changed is the shape behind them — three standard
actions across two controllers, `require_ci!` and the pipeline scope in a
shared base, and a `PipelineSerializer` that carries the fields the endpoint
already answered with, `repo_id` and `woodpecker_repo_id` included (the
duplicate stays: a client may read either, and ci_controller_spec asserts they
agree).
`/api/software/highlighted` answers with `#show` now rather than `#index`: it
returns one title, and the action name should say so. Same address, same body.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+4
-4
@@ -9,14 +9,14 @@ WarpEngine::Engine.routes.draw do
|
||||
end
|
||||
|
||||
get "software", to: "software#index"
|
||||
get "software/highlighted", to: "software_highlighted#index"
|
||||
get "software/highlighted", to: "software_highlighted#show"
|
||||
get "download", to: "downloads#show"
|
||||
get "builds", to: "builds#index"
|
||||
get "softwares/:name/builds", to: "software_builds#show"
|
||||
|
||||
get "ci/pipelines", to: "ci#pipelines"
|
||||
get "ci/pipelines/:id/status", to: "ci#status"
|
||||
post "ci/pipelines/:id/trigger", to: "ci#trigger"
|
||||
get "ci/pipelines", to: "ci/pipelines#index"
|
||||
get "ci/pipelines/:id/status", to: "ci/pipelines#show"
|
||||
post "ci/pipelines/:id/trigger", to: "ci/pipeline_runs#create"
|
||||
end
|
||||
|
||||
post "build/upload", to: "build/uploads#create"
|
||||
|
||||
Reference in New Issue
Block a user