From 0cf6da8e8595f0a3781b9c70e7c85219d00cadf6 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 22 Apr 2020 15:23:31 +0300 Subject: [PATCH] Copy pipelines routing under - scope Signed-off-by: Dmitriy Zaporozhets --- .../unreleased/dz-scope-pipeline-routes.yml | 5 +++ config/routes/pipelines.rb | 36 +++++++++++++++++ config/routes/project.rb | 40 ++++--------------- ee/config/routes/pipelines.rb | 9 +++++ ee/config/routes/project.rb | 8 ---- 5 files changed, 58 insertions(+), 40 deletions(-) create mode 100644 changelogs/unreleased/dz-scope-pipeline-routes.yml create mode 100644 config/routes/pipelines.rb create mode 100644 ee/config/routes/pipelines.rb diff --git a/changelogs/unreleased/dz-scope-pipeline-routes.yml b/changelogs/unreleased/dz-scope-pipeline-routes.yml new file mode 100644 index 00000000000000..ed735200c43980 --- /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 00000000000000..9b236a8ce17d4b --- /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 bcd2fbf4151e11..00bfe02e12588c 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 00000000000000..66a54a51791fd1 --- /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 cc34ff56ef8a73..2980b0ccd57ec4 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 -- GitLab