`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>
29 lines
1021 B
Ruby
29 lines
1021 B
Ruby
WarpEngine::Engine.routes.draw do
|
|
namespace :api do
|
|
get "service", to: "service#show"
|
|
|
|
namespace :auth do
|
|
post "device", to: "devices#create"
|
|
post "device/token", to: "devices#token"
|
|
delete "token", to: "tokens#destroy"
|
|
end
|
|
|
|
get "software", to: "software#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#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"
|
|
post "build/publish", to: "build/publish#create"
|
|
get "build/config", to: "build/configs#show"
|
|
post "build/config", to: "build/configs#create"
|
|
|
|
get "file/*path", to: "files#show", format: false
|
|
end
|