diff --git a/app/models/project_services/chat_message/pipeline_message.rb b/app/models/project_services/chat_message/pipeline_message.rb index 1cd3837433f10bedb80fd360bfc2a0ff4d22ca55..f4c6938fa7848730bc649ec9f1f0b7e6a4189440 100644 --- a/app/models/project_services/chat_message/pipeline_message.rb +++ b/app/models/project_services/chat_message/pipeline_message.rb @@ -183,7 +183,7 @@ def ref_url if ref_type == 'tag' "#{project_url}/-/tags/#{ref}" else - "#{project_url}/commits/#{ref}" + "#{project_url}/-/commits/#{ref}" end end @@ -200,14 +200,14 @@ def project_link end def pipeline_failed_jobs_url - "#{project_url}/pipelines/#{pipeline_id}/failures" + "#{project_url}/-/pipelines/#{pipeline_id}/failures" end def pipeline_url if failed_jobs.any? pipeline_failed_jobs_url else - "#{project_url}/pipelines/#{pipeline_id}" + "#{project_url}/-/pipelines/#{pipeline_id}" end end diff --git a/app/models/project_services/hipchat_service.rb b/app/models/project_services/hipchat_service.rb index c92e8ecb31cda059c613a874fd5a318b87fbf1c5..ad531412fb7e1fc131c5c567cfa6eee10046cdbf 100644 --- a/app/models/project_services/hipchat_service.rb +++ b/app/models/project_services/hipchat_service.rb @@ -252,8 +252,8 @@ def create_pipeline_message(data) status = pipeline_attributes[:status] duration = pipeline_attributes[:duration] - branch_link = "#{ref}" - pipeline_url = "##{pipeline_id}" + branch_link = "#{ref}" + pipeline_url = "##{pipeline_id}" "#{project_link}: Pipeline #{pipeline_url} of #{branch_link} #{ref_type} by #{user_name} #{humanized_status(status)} in #{duration} second(s)" end diff --git a/changelogs/unreleased/dz-redirect-unscoped-pipelines-routes.yml b/changelogs/unreleased/dz-redirect-unscoped-pipelines-routes.yml new file mode 100644 index 0000000000000000000000000000000000000000..dbe7c17f61dcc71454b9c54331e3c8f0437e3b24 --- /dev/null +++ b/changelogs/unreleased/dz-redirect-unscoped-pipelines-routes.yml @@ -0,0 +1,5 @@ +--- +title: Move pipelines routing under /-/ scope +merge_request: 30730 +author: +type: changed diff --git a/config/routes/project.rb b/config/routes/project.rb index 9c979e642cc60cabd9fb80d5957112956b5be25b..e325b0d1c49635eedbe75829ebeca410910c652a 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -315,6 +315,7 @@ draw :issues draw :merge_requests + draw :pipelines # The wiki and repository routing contains wildcard characters so # its preferable to keep it below all other project routes @@ -380,17 +381,6 @@ post 'alerts/notify', to: 'alerting/notifications#create' - # Unscoped route. It will be replaced with redirect to /-/pipelines/ - # Issue https://gitlab.com/gitlab-org/gitlab/issues/118849 - draw :pipelines - - # 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 resources :hooks, only: [:index, :create, :edit, :update, :destroy], constraints: { id: /\d+/ } do # rubocop: disable Cop/PutProjectRoutesUnderScope @@ -486,6 +476,7 @@ # Deprecated unscoped routing. # Issue https://gitlab.com/gitlab-org/gitlab/issues/118849 scope as: 'deprecated' do + draw :pipelines draw :repository end diff --git a/ee/app/assets/javascripts/onboarding/tour_parts.js b/ee/app/assets/javascripts/onboarding/tour_parts.js index 8af95466b6926df967b4e31e1dd794e7ddeb5314..171de500ffc98e0762b91a08bd46cfc9ff8b4690 100644 --- a/ee/app/assets/javascripts/onboarding/tour_parts.js +++ b/ee/app/assets/javascripts/onboarding/tour_parts.js @@ -333,7 +333,7 @@ const GUIDED_GITLAB_TOUR = [ }, }, { - forUrl: ({ projectFullPath }) => new RegExp(`${projectFullPath}/pipelines/[0-9]+$`, ''), + forUrl: ({ projectFullPath }) => new RegExp(`${projectFullPath}/-/pipelines/[0-9]+$`, ''), getHelpContent: () => [ { text: sprintf( @@ -385,7 +385,7 @@ const GUIDED_GITLAB_TOUR = [ const CREATE_PROJECT_TOUR = [ { - forUrl: ({ projectFullPath }) => new RegExp(`${projectFullPath}/pipelines/[0-9]+$`, ''), + forUrl: ({ projectFullPath }) => new RegExp(`${projectFullPath}/-/pipelines/[0-9]+$`, ''), getHelpContent: null, actionPopover: { selector: '#js-onboarding-new-project-link', diff --git a/ee/spec/services/ci/expire_pipeline_cache_service_spec.rb b/ee/spec/services/ci/expire_pipeline_cache_service_spec.rb index 7becf570e564ebfdcb31416139cf3aa7ad8dda2b..762900a5778833cfce814b88cfa1479fe02a5d2b 100644 --- a/ee/spec/services/ci/expire_pipeline_cache_service_spec.rb +++ b/ee/spec/services/ci/expire_pipeline_cache_service_spec.rb @@ -12,7 +12,7 @@ let(:source) { create(:ci_sources_pipeline, pipeline: pipeline) } it 'updates the cache of dependent pipeline' do - dependent_pipeline_path = "/#{source.source_project.full_path}/pipelines/#{source.source_pipeline.id}.json" + dependent_pipeline_path = "/#{source.source_project.full_path}/-/pipelines/#{source.source_pipeline.id}.json" allow_any_instance_of(Gitlab::EtagCaching::Store).to receive(:touch) expect_any_instance_of(Gitlab::EtagCaching::Store).to receive(:touch).with(dependent_pipeline_path) @@ -26,7 +26,7 @@ let(:source) { create(:ci_sources_pipeline, source_job: build) } it 'updates the cache of dependent pipeline' do - dependent_pipeline_path = "/#{source.project.full_path}/pipelines/#{source.pipeline.id}.json" + dependent_pipeline_path = "/#{source.project.full_path}/-/pipelines/#{source.pipeline.id}.json" allow_any_instance_of(Gitlab::EtagCaching::Store).to receive(:touch) expect_any_instance_of(Gitlab::EtagCaching::Store).to receive(:touch).with(dependent_pipeline_path) diff --git a/spec/lib/gitlab/ci/status/stage/play_manual_spec.rb b/spec/lib/gitlab/ci/status/stage/play_manual_spec.rb index b0113b00ef06648b783accda4a30e44aae02d1a4..bdcbfed918fdac5c80f08171be956fa464a10266 100644 --- a/spec/lib/gitlab/ci/status/stage/play_manual_spec.rb +++ b/spec/lib/gitlab/ci/status/stage/play_manual_spec.rb @@ -31,7 +31,7 @@ subject { play_manual.action_path } - it { is_expected.to eq("/#{pipeline.project.full_path}/pipelines/#{pipeline.id}/stages/#{stage.name}/play_manual") } + it { is_expected.to eq("/#{pipeline.project.full_path}/-/pipelines/#{pipeline.id}/stages/#{stage.name}/play_manual") } end describe '#action_method' do diff --git a/spec/lib/gitlab/etag_caching/router_spec.rb b/spec/lib/gitlab/etag_caching/router_spec.rb index b69e4668d61d93ff9e338619ba99715fdc67e91f..d9eeb5b9a2be28e7848a460ec998c3c7eb406dc2 100644 --- a/spec/lib/gitlab/etag_caching/router_spec.rb +++ b/spec/lib/gitlab/etag_caching/router_spec.rb @@ -23,7 +23,7 @@ it 'matches issue title endpoint' do result = described_class.match( - '/my-group/my-project/issues/123/realtime_changes' + '/my-group/my-project/-/issues/123/realtime_changes' ) expect(result).to be_present @@ -32,7 +32,7 @@ it 'matches with a project name that includes a suffix of create' do result = described_class.match( - '/group/test-create/issues/123/realtime_changes' + '/group/test-create/-/issues/123/realtime_changes' ) expect(result).to be_present @@ -41,7 +41,7 @@ it 'matches with a project name that includes a prefix of create' do result = described_class.match( - '/group/create-test/issues/123/realtime_changes' + '/group/create-test/-/issues/123/realtime_changes' ) expect(result).to be_present @@ -50,7 +50,7 @@ it 'matches project pipelines endpoint' do result = described_class.match( - '/my-group/my-project/pipelines.json' + '/my-group/my-project/-/pipelines.json' ) expect(result).to be_present @@ -95,7 +95,7 @@ it 'does not match blob with confusing name' do result = described_class.match( - '/my-group/my-project/blob/master/pipelines.json' + '/my-group/my-project/-/blob/master/pipelines.json' ) expect(result).to be_blank @@ -121,7 +121,7 @@ it 'matches pipeline#show endpoint' do result = described_class.match( - '/my-group/my-project/pipelines/2.json' + '/my-group/my-project/-/pipelines/2.json' ) expect(result).to be_present diff --git a/spec/lib/gitlab/patch/action_dispatch_journey_formatter_spec.rb b/spec/lib/gitlab/patch/action_dispatch_journey_formatter_spec.rb index 5f0e1f40231682fa302afdd670f358102a3b259d..b1c7f73489d56981959fbac62b67598994eb16d3 100644 --- a/spec/lib/gitlab/patch/action_dispatch_journey_formatter_spec.rb +++ b/spec/lib/gitlab/patch/action_dispatch_journey_formatter_spec.rb @@ -7,7 +7,7 @@ let(:project) { create(:project, namespace: group) } let(:pipeline) { create(:ci_empty_pipeline, project: project) } let(:url) { Gitlab::Routing.url_helpers.project_pipeline_url(project, pipeline) } - let(:expected_path) { "#{project.full_path}/pipelines/#{pipeline.id}" } + let(:expected_path) { "#{project.full_path}/-/pipelines/#{pipeline.id}" } context 'custom implementation of #missing_keys' do before do diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index e17471e4527c933ce8d23c0cbcc4e1e625fd10c8..f5f2d17663629fe472fd16193df4e05ba5b048fc 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -2286,7 +2286,7 @@ let(:predefined_variables) do [ { key: 'CI_PIPELINE_ID', value: pipeline.id.to_s, public: true, masked: false }, - { key: 'CI_PIPELINE_URL', value: project.web_url + "/pipelines/#{pipeline.id}", public: true, masked: false }, + { key: 'CI_PIPELINE_URL', value: project.web_url + "/-/pipelines/#{pipeline.id}", public: true, masked: false }, { key: 'CI_JOB_ID', value: build.id.to_s, public: true, masked: false }, { key: 'CI_JOB_URL', value: project.web_url + "/-/jobs/#{build.id}", public: true, masked: false }, { key: 'CI_JOB_TOKEN', value: 'my-token', public: false, masked: true }, diff --git a/spec/models/project_services/chat_message/pipeline_message_spec.rb b/spec/models/project_services/chat_message/pipeline_message_spec.rb index 7c3e48f572ab16c3b3bfa5a060e0a5bd01922809..a717157706345102aa0e1085c857b90a19a4fdfe 100644 --- a/spec/models/project_services/chat_message/pipeline_message_spec.rb +++ b/spec/models/project_services/chat_message/pipeline_message_spec.rb @@ -61,8 +61,8 @@ it "returns the pipeline summary in the activity's title" do expect(subject.activity[:title]).to eq( - "Pipeline [#123](http://example.gitlab.com/pipelines/123)" \ - " of branch [develop](http://example.gitlab.com/commits/develop)" \ + "Pipeline [#123](http://example.gitlab.com/-/pipelines/123)" \ + " of branch [develop](http://example.gitlab.com/-/commits/develop)" \ " by The Hacker (hacker) has passed" ) end @@ -74,8 +74,8 @@ it "returns the summary with a 'failed' status" do expect(subject.activity[:title]).to eq( - "Pipeline [#123](http://example.gitlab.com/pipelines/123)" \ - " of branch [develop](http://example.gitlab.com/commits/develop)" \ + "Pipeline [#123](http://example.gitlab.com/-/pipelines/123)" \ + " of branch [develop](http://example.gitlab.com/-/commits/develop)" \ " by The Hacker (hacker) has failed" ) end @@ -88,8 +88,8 @@ it "returns the summary with a 'passed with warnings' status" do expect(subject.activity[:title]).to eq( - "Pipeline [#123](http://example.gitlab.com/pipelines/123)" \ - " of branch [develop](http://example.gitlab.com/commits/develop)" \ + "Pipeline [#123](http://example.gitlab.com/-/pipelines/123)" \ + " of branch [develop](http://example.gitlab.com/-/commits/develop)" \ " by The Hacker (hacker) has passed with warnings" ) end @@ -102,8 +102,8 @@ it "returns the summary with 'API' as the username" do expect(subject.activity[:title]).to eq( - "Pipeline [#123](http://example.gitlab.com/pipelines/123)" \ - " of branch [develop](http://example.gitlab.com/commits/develop)" \ + "Pipeline [#123](http://example.gitlab.com/-/pipelines/123)" \ + " of branch [develop](http://example.gitlab.com/-/commits/develop)" \ " by API has passed" ) end @@ -134,8 +134,8 @@ it "returns the pipeline summary as the attachment's fallback property" do expect(subject.attachments.first[:fallback]).to eq( ":" \ - " Pipeline " \ - " of branch " \ + " Pipeline " \ + " of branch " \ " by The Hacker (hacker) has passed in 02:00:10" ) end @@ -199,7 +199,7 @@ end it "returns the pipeline URL as the attachment's title_link property" do - expect(subject.attachments.first[:title_link]).to eq("http://example.gitlab.com/pipelines/123") + expect(subject.attachments.first[:title_link]).to eq("http://example.gitlab.com/-/pipelines/123") end it "returns two attachment fields" do @@ -209,7 +209,7 @@ it "returns the commit message as the attachment's second field property" do expect(subject.attachments.first[:fields][0]).to eq({ title: "Branch", - value: "", + value: "", short: true }) end @@ -237,7 +237,7 @@ it "returns the stage name and link to the 'Failed jobs' tab on the pipeline's page as the attachment's third field property" do expect(subject.attachments.first[:fields][2]).to eq({ title: "Failed stage", - value: "", + value: "", short: true }) end @@ -261,7 +261,7 @@ it "returns the stage names and links to the 'Failed jobs' tab on the pipeline's page as the attachment's third field property" do expect(subject.attachments.first[:fields][2]).to eq({ title: "Failed stages", - value: ", , ", + value: ", , ", short: true }) end @@ -271,7 +271,7 @@ "" end - expected_jobs << "and " + expected_jobs << "and " expect(subject.attachments.first[:fields][3]).to eq({ title: "Failed jobs", @@ -369,8 +369,8 @@ it 'returns the pipeline summary as the attachments in markdown format' do expect(subject.attachments).to eq( "[project_name](http://example.gitlab.com):" \ - " Pipeline [#123](http://example.gitlab.com/pipelines/123)" \ - " of branch [develop](http://example.gitlab.com/commits/develop)" \ + " Pipeline [#123](http://example.gitlab.com/-/pipelines/123)" \ + " of branch [develop](http://example.gitlab.com/-/commits/develop)" \ " by The Hacker (hacker) has passed in 02:00:10" ) end diff --git a/spec/models/project_services/hipchat_service_spec.rb b/spec/models/project_services/hipchat_service_spec.rb index ae6e93cfe3aa1695e8ee61a15f1213f88bb97796..c25edf8135216789893cd0b564d7aaea712666bf 100644 --- a/spec/models/project_services/hipchat_service_spec.rb +++ b/spec/models/project_services/hipchat_service_spec.rb @@ -327,8 +327,8 @@ user_name = data[:user][:name] expect(message).to eq("#{project_name}: " \ - "Pipeline ##{pipeline.id} " \ - "of #{ref} #{ref_type} " \ + "Pipeline ##{pipeline.id} " \ + "of #{ref} #{ref_type} " \ "by #{user_name} failed in #{duration} second(s)") end end diff --git a/spec/serializers/merge_request_widget_entity_spec.rb b/spec/serializers/merge_request_widget_entity_spec.rb index 40a0f09d1f3b1c841d4bd032a2bd8558d9f7948e..039fb311bfcd3bf9ddfa3f8a3aab011aaa97361c 100644 --- a/spec/serializers/merge_request_widget_entity_spec.rb +++ b/spec/serializers/merge_request_widget_entity_spec.rb @@ -178,7 +178,7 @@ project.add_maintainer(user) expect(subject[:new_project_pipeline_path]) - .to eq("/#{resource.project.full_path}/pipelines/new") + .to eq("/#{resource.project.full_path}/-/pipelines/new") end describe 'when source project is deleted' do diff --git a/spec/services/ci/expire_pipeline_cache_service_spec.rb b/spec/services/ci/expire_pipeline_cache_service_spec.rb index 78e1ba0109a277a678f07f0150a023ffe6fd0f84..2962e9dd31edecf5f75ef014dbd463f9bbd76954 100644 --- a/spec/services/ci/expire_pipeline_cache_service_spec.rb +++ b/spec/services/ci/expire_pipeline_cache_service_spec.rb @@ -10,9 +10,9 @@ describe '#execute' do it 'invalidates Etag caching for project pipelines path' do - pipelines_path = "/#{project.full_path}/pipelines.json" + pipelines_path = "/#{project.full_path}/-/pipelines.json" new_mr_pipelines_path = "/#{project.full_path}/-/merge_requests/new.json" - pipeline_path = "/#{project.full_path}/pipelines/#{pipeline.id}.json" + pipeline_path = "/#{project.full_path}/-/pipelines/#{pipeline.id}.json" expect_any_instance_of(Gitlab::EtagCaching::Store).to receive(:touch).with(pipelines_path) expect_any_instance_of(Gitlab::EtagCaching::Store).to receive(:touch).with(new_mr_pipelines_path) diff --git a/spec/workers/expire_job_cache_worker_spec.rb b/spec/workers/expire_job_cache_worker_spec.rb index 804a50e89fe8204157d163449ee0354adebaafd9..062926cf7aa1063e620750743c305e9d2f7fa7aa 100644 --- a/spec/workers/expire_job_cache_worker_spec.rb +++ b/spec/workers/expire_job_cache_worker_spec.rb @@ -13,7 +13,7 @@ include_examples 'an idempotent worker' do it 'invalidates Etag caching for the job path' do - pipeline_path = "/#{project.full_path}/pipelines/#{pipeline.id}.json" + pipeline_path = "/#{project.full_path}/-/pipelines/#{pipeline.id}.json" job_path = "/#{project.full_path}/builds/#{job.id}.json" spy_store = Gitlab::EtagCaching::Store.new