diff --git a/changelogs/unreleased/dz-scope-pipeline-routes.yml b/changelogs/unreleased/dz-scope-pipeline-routes.yml new file mode 100644 index 0000000000000000000000000000000000000000..ed735200c43980bcc598ade95e2764f5a10a1260 --- /dev/null +++ b/changelogs/unreleased/dz-scope-pipeline-routes.yml @@ -0,0 +1,5 @@ +--- +title: Copy pipelines routing under - scope +merge_request: 30159 +author: +type: changed diff --git a/config/routes/pipelines.rb b/config/routes/pipelines.rb new file mode 100644 index 0000000000000000000000000000000000000000..9b236a8ce17d4ba7dd4aa6afd16999a1ec87aa29 --- /dev/null +++ b/config/routes/pipelines.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +resources :pipelines, only: [:index, :new, :create, :show, :destroy] do + collection do + resource :pipelines_settings, path: 'settings', only: [:show, :update] + get :charts + scope '(*ref)', constraints: { ref: Gitlab::PathRegex.git_reference_regex } do + get :latest, action: :show, defaults: { latest: true } + end + end + + member do + get :stage + get :stage_ajax + post :cancel + post :retry + get :builds + get :failures + get :status + get :test_report + get :test_reports_count + end + + member do + resources :stages, only: [], param: :name do + post :play_manual + end + end +end + +resources :pipeline_schedules, except: [:show] do + member do + post :play + post :take_ownership + end +end diff --git a/config/routes/project.rb b/config/routes/project.rb index bcd2fbf4151e113ccbb93f90a50f33a9bc8c3b47..00bfe02e12588ca243b946b21fdd58ddaea5a0f8 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -365,39 +365,15 @@ post 'alerts/notify', to: 'alerting/notifications#create' - resources :pipelines, only: [:index, :new, :create, :show, :destroy] do - collection do - resource :pipelines_settings, path: 'settings', only: [:show, :update] - get :charts - scope '(*ref)', constraints: { ref: Gitlab::PathRegex.git_reference_regex } do - get :latest, action: :show, defaults: { latest: true } - end - end - - member do - get :stage - get :stage_ajax - post :cancel - post :retry - get :builds - get :failures - get :status - get :test_report - get :test_reports_count - end - - member do - resources :stages, only: [], param: :name do - post :play_manual - end - end - end + # Unscoped route. It will be replaced with redirect to /-/pipelines/ + # Issue https://gitlab.com/gitlab-org/gitlab/issues/118849 + draw :pipelines - resources :pipeline_schedules, except: [:show] do - member do - post :play - post :take_ownership - end + # To ensure an old unscoped routing is used for the UI we need to + # add prefix 'as' to the scope routing and place it below original routing. + # Issue https://gitlab.com/gitlab-org/gitlab/issues/118849 + scope '-', as: 'scoped' do + draw :pipelines end draw :legacy_builds diff --git a/ee/config/routes/pipelines.rb b/ee/config/routes/pipelines.rb new file mode 100644 index 0000000000000000000000000000000000000000..66a54a51791fd127d913565abd7e7e2f26685fc9 --- /dev/null +++ b/ee/config/routes/pipelines.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +resources :pipelines, only: [] do + member do + get :security + get :licenses + get :codequality_report + end +end diff --git a/ee/config/routes/project.rb b/ee/config/routes/project.rb index cc34ff56ef8a739fbe27e18117e96405eb36c6b2..2980b0ccd57ec43c263377da880b3b95099870ca 100644 --- a/ee/config/routes/project.rb +++ b/ee/config/routes/project.rb @@ -148,14 +148,6 @@ post '/restore' => '/projects#restore', as: :restore - resources :pipelines, only: [] do - member do - get :security - get :licenses - get :codequality_report - end - end - resource :insights, only: [:show], trailing_slash: true do collection do post :query